How to set focus to the previously selected item in list box????

Results 1 to 3 of 3

Thread: How to set focus to the previously selected item in list box????

  1. #1
    Sham Sunder Gautam Guest

    Default How to set focus to the previously selected item in list box????

    Dear sir,<BR> I created a FORM and a LIST BOX with say 10 items then the user will select one item from the list box and after that he will press a button and then I want to submit the form and then display on the page the same list box with focus being set to the item selected by the user.<BR><BR>How can I do this as I have tried the following line of code:<BR>formname.listbox(listindex).selected=true <BR>but it does not work as we have submitted the form so it does not recognise the form object after submission as far as I know.<BR>So you suggest me how to do it and try to respond ASAP as it is very urgent for me to find the solution to this problem.<BR>I think you have understood my problem.<BR><BR>if not then you can mail to me at sham@sapientinfotech.com<BR><BR>Thanks<BR>Sham Sunder Gautam<BR>

  2. #2
    Mark Wilson Guest

    Default RE: How to set focus to the previously selected item in list box????

    One way is something like this:<BR><BR>&#060;select name="..."><BR>&#060;%<BR>for loop = 1 to 10<BR> strOpt = "&#060;option value=&#039" & optVal(loop)& "&#039"<BR> if loop = selectedindex then<BR> strOpt = strOpt & " SELECTED"<BR> end if<BR> strOpt = strOpt & ">" & optLabel(loop) & "&#060;/option>"<BR> Response.write strOpt & vbCRLF<BR>next<BR>&#037;&#062;<BR>&#060;/select>

  3. #3
    S.S.Gautam Guest

    Default RE: (Couldnot get anything) How to set focus to the previously selected item in list box????

    Dear Sir,<BR>I couldnot get what you have written as there is no proper explanation for the code.<BR>I think you have not understood my problem so once again I am defining it.<BR><BR>Problem:<BR><BR>I want to create a form with a list box,some text boxes and a button.The user will eneter some input in the text boxes then he will select one item from the list box and then he will click on the button and after that I will do some processing and then the form will be submitted to itself and after that I will display all the text boxes showing the inputs entered by the user and the list box also being set to the item selected by the user and then I will display some results form the entered input in the lower part of the page.<BR>Sir I can manage everything but I donot know how I will show the item selected by the user in the list box.<BR>Reply ASAP.<BR><BR>S.S.Gautam<BR><BR><BR><BR>

Posting Permissions

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