PDA

View Full Version : problems with if .... then



numbenator
16 Aug 2005, 11:15 AM
:smash:

Hi,
Im using the below form with select in portal-referal.asp

<form style="margin-bottom:0px;" name="portals" action="portal-referal.asp">

<select name='portals' onChange='this.form.submit()'>
<option value='Select portals'>Select portals</option>
<option value='Money'>Money</option>
<option value='Your Studies'>Your Studies</option>
<option value='Get Support'>Get Support</option>
<option value='Getting Arround'>Getting Arround</option>
<option value='Kingsotn Life'>Kingsotn Life</option>
<option value='Your University'>Your University</option>
<option value='Accommodation'>Accommodation</option>
<option value='International'>International</option></select>

</form>

In my code, within portal-referal.asp, under option explicit, I check :

selected=false
if request.form("portals") <> "" then
if request.form("portals") <> "Select portal" then
selected=true
end if
end if

MY problem is that 'selected' is ALWAYS false even when i make a selection on the form.

I can't figure if it's the 'if then' or because when the page returns to the client, the <select> is reset.

Could some one please help.

cheers.

sajjad27s
22 Sep 2005, 09:25 AM
if request.form("portals") <> "" and request.form("portals") <> "Select portal" then
selected = true
else
selected = false
end if



try this

if you do not want the list to reset, you have to set the value dynmically. Check the returned value and put the "selected" attribute in <option ...> tag dynamically.