Gossamer Forum
Home : Products : Gossamer Links : Discussions :

"Select Form" for include_form Template

Quote Reply
"Select Form" for include_form Template
I added in a column for users to select the number of rooms a location has (0,1,2,3,4,5). How do I get this to display on the input form (include_form)? Right now it is showing up as a basic input box.

Code I am currently using on include_form
<input name="rooms" value="<%if rooms%><%rooms%><%endif%>">

Thanks in Advance
Quote Reply
Re: [Soren] "Select Form" for include_form Template In reply to
Hi,

Something like below should work

<select name="rooms" size=1>
<option <%if rooms eq '0'%> selected>0</option>
<option <%if rooms eq '1'%> selected>1</option>
<option <%if rooms eq '2'%> selected>2</option>
<option <%if rooms eq '3'%> selected>3</option>
<option <%if rooms eq '4'%> selected>4</option>
<option <%if rooms eq '5'%> selected>5</option>
</select>

Cheers,

Cheers,

Dat

Programming and creating plugins and templates
Blog
Quote Reply
Re: [tandat] "Select Form" for include_form Template In reply to
Thanks Dat.... I couldn't get that to work, but with this modification it kinda does. The issue now is the numbers are not visible on the menu unless they were previously selected. They show up now as blank.

<select id="rooms" name="rooms" size=1>
<option <%if rooms eq '0'%> selected>0<%endif%></option>
<option <%if rooms eq '1'%> selected>1<%endif%></option>
<option <%if rooms eq '2'%> selected>2<%endif%></option>
</select>

How do I set it up so thenumbers show up even if not previously selected.

Thanks

Last edited by:

Soren: Nov 3, 2007, 11:44 AM
Quote Reply
Re: [tandat] "Select Form" for include_form Template In reply to
You forgot to close the if's. <option<%if rooms eq '0'%> selected="selected"<%endif%>>0</option>

Adrian
Quote Reply
Re: [brewt] "Select Form" for include_form Template In reply to
Thanks Adrian! That works

I had just modified my previous post with new code while you were posting. So don't pay attention to it. lol
Quote Reply
Re: [Soren] "Select Form" for include_form Template In reply to
Well, your post is still broken. The endif is in the wrong place (it's after the closing > of option).

Adrian
Quote Reply
Re: [brewt] "Select Form" for include_form Template In reply to
Hi,

Try this:

Code:
<select id="rooms" name="rooms" size=1>
<option <%if rooms eq '0'%> selected<%endif%>>0</option>
<option <%if rooms eq '1'%> selected<%endif%>>1</option>
<option <%if rooms eq '2'%> selected<%endif%>>2</option>
</select>

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!