Retain dropdown select search selection onChange

3 posts by 2 authors in: Forums > CMS Builder
Last Post: January 23, 2019   (RSS)

By daniel - January 23, 2019

Hi Zicky,

When you select either of the dropdowns, does it clear both of the other fields? I can't currently see anything wrong with the text field, so if that isn't retaining its value on submit then there might be something at play earlier in the code. 

For the dropdowns, you should be able to use the selectedIf() function that's already present in the first one. The format for this is "selectedIf( optionValue, selectedValue )". The existing one is close; you should just need to change "document_category" to "document_category_match" so that it's the same as the select's name, like this:

<option value="<?php echo $value; ?>" <?php selectedIf($value, @$_REQUEST['document_category_match']) ?>><?php echo $label; ?></option>

The same can be added to the second dropdown's options, with "date_year" used instead of "document_category_match".

Let me know if this helps with any of your issues, or if you have any questions!

Thanks,

Daniel
PHP Programmer
interactivetools.com

By Zicky - January 23, 2019

Thanks for your guidance on this Daniel!

Your suggestions/solution got me headed in the right direction and everything works like a charm now!

Cheers, Zicky