Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Solution to hide the Middle Name input field on the additional fields step in Actions
<script type="text/javascript">
/*This script will hide the Middle Name field when it is requested by the legislator
In its place the script will submit a blank space for the middle name.*/
// select the target node
//#mainForm only appears on the additional fields step
var target = document.getElementById('mainForm');
// create an observer instance
var observer = new MutationObserver(function(mutations) {
mutations.some(function(mutation) {
if ($("#webformInput").length > 0) {
if ($("#MIDDLE_NAME").length > 0) {
//Change the Middle Initial value to be a blank space and hide the field.
$("#MIDDLE_NAME").val(" ");
}//end if #MIDDLE_NAME
//stop observing we're done break out of the loop
return true;
}//end if #webformInput
});//end mutations.some
});//end MutationObserver
// configuration of the observer:
var config = { childList: true, subtree: true };
// pass in the target node, as well as the observer options
observer.observe(target, config);
});//end $(document).ready
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.