We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26503
    • 620 Posts
    How do I [correctly] set up my registration form to ’remember’ the option in a select box if the user registration page is reloaded - i.e. something didn’t validate and the user is returned to the register page.

    Currently I’ using:

    
    <label>Salutation:<span class="form-required">*</span></label>
    <select name="salutation:required" class="form-select" id="salutation" >
    	<option selected="selected"> </option>
    	<option value="Dr." [[!If? &subject=`[[+salutation]]` &operator=`EQ`  &operand=`Dr,.` &then=`selected="selected"` ]]>Dr.</option>
    	<option value="Mr." [[!If? &subject=`[[+salutation]]` &operator=`EQ`  &operand=`Mr.` &then=`selected="selected"` ]] >Mr.</option>
    	<option value="Mrs." [[!If? &subject=`[[+salutation]]` &operator=`EQ`  &operand=`Mrs.` &then=`selected="selected"` ]]>Mrs.</option>
    	<option value="Ms." [[!If? &subject=`[[+salutation]]` &operator=`EQ`  &operand=`Ms.` &then=`selected="selected"` ]]>Ms.</option>
    </select>
    <span class="error">[[+error.salutation]]</span>
    
    


    And that works, but it seems kinda messy - is there a better/more correct way to do this properly?



    Also - how do I validate check boxes/radio buttons... I have a set of radio buttons, a selection is required, but

    
    <p>Agreement: I have read and I agree to the <a href="[[~217]]" target="_blank">conditions and terms of use</a>.</p>
    <ul>
    	<li>
    		<label>No, I do not agree to the terms and conditions</label>
    		<input type="radio" id="eula-agreement-disagree" name="eula-agreement" value="No, I do not agree to the terms and conditions"   class="form-radio" />
    	</li>
    	<li>
    		<label>Yes, I agree to the terms and conditions</label>
    		<input type="radio" id="eula-agreement-agree" name="eula-agreement:required" value="Yes, I agree to the terms and conditions"   class="form-radio" />
    	</li>
    </ul>
    <span class="error">[[+error.eula-agreement]]</span>
    


    Does not work... I also have another radio set of 5 options, one has to be selected but not one in particular, just so long as one is.

    -thanks
    -sean
      *** Not just websites, we also create signage, banners, print, trade show displays and more! ***

      Sean Kimball CLP, CLS.
      Technical Director / Sr. Developer | BigBlock Studios
      ._______________________________________________.
      Bigblock Studios http://www.bigblockstudios.ca Web site design & development.
      27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
      phone/fax: 905-426-5525