The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Toggling within a Form
Forbes2000
post Nov 1 2018, 10:58 AM
Post #1





Group: Members
Posts: 1
Joined: 1-November 18
Member No.: 26,740



Hi there, I am trying to adjust this form snippet so that it does not toggle the "recurring donation type" question. I would like it by default to select the "Yes" radio option and then by default the "Monthly" type option.
But when I make "yes" the default radio button the form does not display the "recurring type" drop down because it's set as a toggle.
Can anyone help me clean this code to not toggle?
Thanks!

CODE

<form name="pShoppingCartFormBean" method="post" action="https://lc.z2systems.com/np/publicaccess/survey.do" onsubmit="return snippet_validateNeonForm();"><input type=password autocomplete='off' style='display:none'><input type=hidden name="skipDuplicateRequestCheck" value="1"><input type=hidden name="surveyId" value="31" /><input type=hidden name="currentPage" value="1" /><input type=hidden name="direction" id="snippet_direction" value="next" /><div id=snippet_surveyForm class=snippet_tbmain><table border=0 width=520 cellpadding=5 cellspacing=0> <tbody><tr>    <td colspan=2 align="right" >            </td></tr>  <tr id="snippet_donation.amount1">    <td width=150 class=leftLabel>      <label>Amount  <SPAN class=required>*</SPAN> </label>    </td>    <td class=rightField>      <input type="text" name="donation.amount" maxlength="100" size="20" value="" id="snippet_donation.amount" class="control_textbox">    </td>  </tr>  <tr id="snippet_recurringDonation.recurringInterval1">    <td width=150 class=leftLabel>      <label>Recurring Type </label>    </td>    <td class=rightField>      <select name="recurringDonation.recurringInterval" size="1" id="snippet_recurringDonation.recurringInterval" class="control_dropdown"><option value=""></option>       <option value="1m">Monthly</option></select>    </td>  </tr>  <tr id="snippet_recurringFlag1">    <td width=150 class=leftLabel>      <label>Make this a recurring donation deducted </label>    </td>    <td class=rightField>      <input type="radio" name="recurringFlag" value="1" onclick="associateToggle(this.value, 'snippet_recurringDonation.recurringInterval1')" id="snippet_recurringFlag" class="control_radio snippet_nsc_recurringFlag"><span class=control_text>Yes</span><br>      <input type="radio" name="recurringFlag" value="0" checked="checked" onclick="associateToggle(this.value, 'snippet_recurringDonation.recurringInterval1')" id="snippet_recurringFlag" class="control_radio snippet_nsc_recurringFlag"><span class=control_text>No</span><br>    </td>  </tr>  <tr id="snippet_person.firstName1">    <td width=150 class=leftLabel>      <label>First Name </label>    </td>    <td class=rightField>      <input type="text" name="person.firstName" maxlength="100" size="20" value="" id="snippet_person.firstName" class="control_textbox">    </td>  </tr>  <tr id="snippet_person.lastName1">    <td width=150 class=leftLabel>      <label>Last Name </label>    </td>    <td class=rightField>      <input type="text" name="person.lastName" maxlength="100" size="20" value="" id="snippet_person.lastName" class="control_textbox">    </td>  </tr>  <tr id="snippet_person.email11">    <td width=150 class=leftLabel>      <label>Email </label>    </td>    <td class=rightField>      <input type="text" name="person.email1" maxlength="100" size="20" value="" id="snippet_person.email1" class="control_textbox">    </td>  </tr>  <tr style='padding:0px;margin:0px; height:0px;'><td style='padding:0px;margin:0px; height:0px;'><input type=hidden name='donation.campaign' value='60'></td></tr>  <tr id="snippet_null1">    <td colspan=2 align=center>      <input type="submit" name="null" class="control_button snippet_control_button" value="Submit" id="snippet_null">    </td>  </tr> </tbody></table></div><input type=hidden name=orgId value=lc></form><script src="https://lc.z2systems.com/np/js/regExpValidate.js" type=text/javascript></SCRIPT><script>var minimumAmount = 0;var minimumRecurring = 0;function validateNeonStandardEmail(){if(document.getElementById("snippet_person.email1") && document.getElementById("snippet_person.email1").value.trim().length>0){return validateSurveyEmail(document.getElementById("snippet_person.email1").value);}return true;}</script><script language=javascript type=text/javascript>function snippet_validateNeonForm() { if(document.getElementById("snippet_direction").value=="previous"){  return true;}if(!validatePwd('account.loginPassword')){return false;}if(!validateNeonStandardEmail()){   alert("The Email Address is invalid.");    document.getElementById("snippet_person.email1").focus();    return false;}if(document.getElementById("snippet_donation.amount")||document.getElementsByClassName("snippet_nsc_donation.amount").length>0){  if ( !validateNotEmpty(document.getElementById("snippet_donation.amount").value ) ){    alert("Amount is required.");    document.getElementById("snippet_donation.amount").focus();    return false;  }} if (validateAmount() == false) return false;  var buttons = document.getElementsByClassName("snippet_control_button");  for(var i=0;i<buttons.length;i++){      buttons[i].disabled = true;   }  return true;}</SCRIPT><script language=javascript type=text/javascript>function populateValueFromRadio(textBoxId,radioId,hiddenObjId){var radios=document.getElementsByClassName(radioId);var hiddenObj = document.getElementById(hiddenObjId);var txtboxObj = document.getElementById(textBoxId);for(var i=0;i<radios.length;i++){  if(radios[i].checked){      hiddenObj.value=radios[i].value;  }}if( txtboxObj != undefined && (hiddenObj.value == null || hiddenObj.value == "") ) {   var dAmt = trimAll(removeCurrency(txtboxObj.value));   if (dAmt==""){      txtboxObj.focus();   } else {      hiddenObj.value = dAmt;   }}}function leavingTextBox(textBoxId,radioId,hiddenObjId){var radios=document.getElementsByClassName(radioId);var hiddenObj = document.getElementById(hiddenObjId);var txtboxObj = document.getElementById(textBoxId);for(var i=0;i<radios.length;i++){  if(radios[i].checked){    hiddenObj.value=radios[i].value;    if(txtboxObj != undefined && (radios[i].value == null || radios[i].value == "")) {       var dAmt = trimAll(removeCurrency(txtboxObj.value));       if (dAmt==""){              alert("Please enter donation amount");              txtboxObj.focus();              return false;       } else if (validateNumeric(dAmt)==false) {              alert("The donation amount should be a number.");              txtboxObj.focus();              return false;       } else if (validatePositiveAndZero(dAmt) == false){            alert("The donation amount should be bigger than 0.");            return false;        } else if(validateNumeric(dAmt)==true){            var numdAmt = dAmt;            numdAmt=numdAmt.replace(',','');            while(numdAmt.indexOf(',')!=-1){                numdAmt=numdAmt.replace(',','');            }            numdAmt = numdAmt.split('.');            if(numdAmt[0].length>13){                alert('Your donation amount is too large.');                return false;            }            if(isChecked('recurringFlag', '1')){               if(validateMinimumRecurring(dAmt) == false){                       alert("You have not entered the minimum recurring donation amount of $"+Number(minimumRecurring).toFixed(2)+'.');                       return false;               }            }else{                if(validateMinimumAmount(dAmt)==false){                    alert('You have not entered the minimum donation amount of  $'+Number(minimumAmount).toFixed(2)+'.');                    return false;                }            }              hiddenObj.value = dAmt;              return true;       }    }     return true;  }}}function validatePositiveAndZero(val){     if(Number(val) <= 0){        return false;     }}function validateMinimumAmount(val){    if(minimumAmount && minimumAmount > 0 && minimumAmount > val){        return false;   }    return true;}function validateMinimumRecurring(val){    if(minimumRecurring && minimumRecurring > 0 && minimumRecurring > val){        return false;   }    return true;}function isChecked(name, value){  var list = getAllByName(name);  for(var i=0; i<list.length; i++){       if(list[i].checked==true && list[i].value==value){           return true;       }   }   return false;}function getAllByName(name){  return document.getElementsByName(name);}function validateAmount(){   var txtboxObj = document.getElementById('snippet_donation.amount');    if(txtboxObj != undefined){        var dAmt = trimAll(removeCurrency(txtboxObj.value));           if (dAmt==""){                  alert("Please enter donation amount");                  txtboxObj.focus();                  return false;           } else if (validateNumeric(dAmt)==false) {                  alert("The donation amount should be a number.");                  txtboxObj.focus();                  return false;           } else if (validatePositiveAndZero(dAmt) == false){                alert("The donation amount should be bigger than 0.");                return false;            } else if (validateNumeric(dAmt)==true){                var numdAmt = dAmt;                numdAmt=numdAmt.replace(',','');                while(numdAmt.indexOf(',')!=-1){                    numdAmt=numdAmt.replace(',','');                }                 numdAmt = numdAmt.split('.');                if(numdAmt[0].length>13){                    alert('Your donation amount is too large.');                    return false;                }                if(isChecked('recurringFlag', '1')){                   if(validateMinimumRecurring(dAmt) == false){                           alert("You have not entered the minimum recurring donation amount of $"+Number(minimumRecurring).toFixed(2)+'.');                           return false;                   }                }else{                    if(validateMinimumAmount(dAmt)==false){                        alert('You have not entered the minimum donation amount of $'+Number(minimumAmount).toFixed(2)+'.');                        return false;                    }                }                }    }    return true;}function associateToggle(val, elem){var elem = document.getElementById(elem);if(elem == null) return;if(val == 1){    elem.style.display="";}else if(val == 0){    elem.style.display="none";}}associateToggle(0, 'snippet_recurringDonation.recurringInterval1');function validatePwd(property){ var item = document.getElementById(property);if(item != null && 'account.loginPassword' === property){var loginName = document.getElementById('snippet_account.loginName');if(loginName != null && loginName.value.trim() != ''){ var regexp = /(?=\S*\d)\S{8,}$/; var blankRegexp = /\s/;  if(!regexp.test(item.value) || blankRegexp.test(item.value)){   alert('Your password requires at least 8 characters, including at least one number. Spaces are not allowed.');       return false;   }   var retypePwd = document.getElementById('snippet_loginPasswordRetype').value;   if(item.value != retypePwd){       alert('The re-typed password doesn\'t match your original password');       return false;   } } }   return true;}</SCRIPT><!--NEON FORM END-->    
    
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 17th January 2019 - 08:39 PM