Exclude options in category drop down in form

14 posts by 2 authors in: Forums > CMS Builder
Last Post: July 30, 2014   (RSS)

By design9 - July 30, 2014

tablename = dir_categories

fieldname = name   (value and label)

I was using the get list options so it would not reset the drop down on submit or user error message. 

One other question: Using the add form.php, it has a  action="?preSaveTempId=<?php echo $preSaveTempId ?>" for the action. Is there another way that I can still submit the form and send it to a separate thank-you page?

I have also included my file if you need to look at that. 

Thanks for all your help with this!!!

Attachments:

freeform1.php 23K

By claire - July 30, 2014

I'll ask one of the senior devs here about the other question.

Try changing the select like so:

<?php list($categoriesRecords, $categoriesMeta) = getRecords(array(
    'tableName' => 'dir_categories',
    'where      => 'hidden = 0'
));
<select name="category">
<option value = "">-Select-</option>
<?php foreach ($categoriesRecords as $record): ?>
<option value = "<?php echo htmlspecialchars($record['name']);?>" <?php selectedIf($record['name'], @$_REQUEST['category']);?>> <?php echo htmlspecialchars($record['name']);?> </option>
<?php endforeach ?>
</select>

--------------------

Claire Ryan
interactivetools.com

Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

By design9 - July 30, 2014

That works but then I go back to the issue of if the user forgets to fill out a required field, then the drop down category options are not retained and user would have to refresh page to get drop down options again. Is there anyway around that without using the getlistOptions?