Results 1 to 2 of 2

Thread: problems with if .... then

  1. #1
    Join Date
    Dec 2004
    Posts
    152

    problems with if .... then



    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.

  2. #2
    Join Date
    Sep 2005
    Posts
    20
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •