We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 34004
    • 125 Posts
    I want to populate about 20 options in a dropdown using a Rowboat call from a custom DB table. My code is:

    
    <select name="category">
                <option value="">Select a category...</option>
                	[[Rowboat? 
                		&table=`cc_neilsenCategories`
                		&tpl=`rowboat-formit-select2`
                		&limit=`0`
                		&sortBy=`id`
                	]]
                </select>
    
    


    My rowboat-formit-select2 chunk looks like:

    <option value="[[+name]]" [[!+fi.category:FormItIsSelected=`[[+name]]`]]>[[+name]]</option>
    


    It all works ok until a form is submitted and something somewhere on the form doesn't pass validation. The select box doesn't remember it's value, I assume it's because of +fi.category is actually looking for a field in the database due to rowboat and it's coming up blank and therefore the "selected" word isn't appearing.

    Can anyone recommend a way around this or a better way to achieve the select box remembering it's value after failed form validation is submitted?
      • 4172
      • 5,888 Posts
      First. Call it uncached

      [[!Rowboat?
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 34004
        • 125 Posts
        I think that may have solved it. Thanks Bruno, once again!