We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8343
    • 6 Posts
    Hello, I’m trying to figure out how to save the data filled in a form after a user submits it and the form contains error, so that users don’t have to enter everything again.
    This is my problem: our website we have this registration page http://www.expresssignproducts.com/register.html. If there’s a validation error, you’re presented with the same form, of course, and even though some data is saved, like the text fields name, phone, etc., all select fields are not. How can I save all the fields, then?
    Here’s a sample of the html:
    <tr bgcolor="#fffacd">
    <td align="right">City <span class="RequiredField">*</span></td>
    <td align="left">
                          <label>
                            <input id="City" maxlength="25" name="city:required" size="25" type="text" value="[[+city]]" />
                          [[+error.city]]                    </label>
                          </td>
    </tr>
    <tr>
    <td align="right">Province/State</td>
    <td align="left"><label>
                            <select id="Province" name="state">
                                                        <option value="AL">Alabama</option>
                                                        <option value="AK">Alaska</option>
                                                        <option selected="selected" value="AB">Alberta</option>
                                                        <option value="AZ">Arizona</option>
                                                        <option value="AR">Arkansas</option>
                                                        <option value="BC">British Columbia</option>
    <!--more values-->
                                                      </select>
                          </label></td>
    </tr>
    
    

    So, whenever there is an error, the form saves the city typed by the registrant, but the province/state is reverted to "Alberta".
    Thanks!

    Eduardo
      • 12028
      • 152 Posts
      You could use Formit - it have some snippets which are saving the contents of options, radios and checkboxes.
      http://rtfm.modx.com/display/ADDON/FormIt.Handling+Selects%2C+Checkboxes+and+Radios
        - A small step for mankind, so why not take two...

        Working with web production, graphic design/workflow, photo and education - but are trying to get a life in between!
        • 3749
        • 24,544 Posts
        Please don’t double post.
          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting
          • 8343
          • 6 Posts
          Thank you for pointing me to the Formit. I’ll see if I can use it with this.

          Regards,

          Eduardo