Search options

4 posts by 2 authors in: Forums > CMS Builder
Last Post: August 2, 2012   (RSS)

Re: [apolgree] Search options

By Jason - August 1, 2012

Hi,

You're right that the best option would be to to have the form submit. If you set your form method to "get", then the options you select will appear in the URL so the page would be bookmarkable.

If you don't want a submit button, you can have a submit function that is called on the onchange event of your drop downs. The event will submit your form so you don't need a separate button. Take a look at this article:
http://www.javascript-coder.com/javascript-form/javascript-form-submit.phtml

Finally, you can use the selectedIf() function to maintain your drop downs state.

For example:

<select onchange="submitForm();" size="1" name="grade_level,content_keyword">
<option value="">BY GRADE LEVEL</option>
<option value="3-4" <?php selectedIf("3-4", @$_REQUEST['grade_level,content_keyword']);?>>3-4</option>
<option value="5-6" <?php selectedIf("5-6", @$_REQUEST['grade_level,content_keyword']);?>>5-6</option>
<option value="7-8" <?php selectedIf("7-8", @$_REQUEST['grade_level,content_keyword']);?>>7-8</option>

</select>


Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

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

Re: [Jason] Search options

By apolgree - August 1, 2012

Thanks Jason, works nicely. Much appreciated. Any easy way to get rid of the resulting %2C for the commas in the URLs? Thanks again.

Re: [apolgree] Search options

By Jason - August 2, 2012

Hi,

%2C denotes a comma in the URL string. It's just the way the url is encoded so that special characters are interpreted correctly. There isn't really a good way to remove them, but they won't affect the way your page works

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

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