Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: retaining value in a listbox after submittig


Message #1 by "Adeola" <aoadeyemo@h...> on Thu, 29 Mar 2001 18:42:52
Hi everyone,

I'm trying to submit a page to itself whereby i have a listbox via the 

select tag and once the user has selected an item they can submit the form.

The problem is, i want the value the user has selected to remain in place 

without refreshing once submitted. This works fine using <iframe>, but i'm 

not allowed to use that.

Please help.

Ade'
Message #2 by "Peter Lanoie" <planoie@e...> on Fri, 30 Mar 2001 10:11:07 -0500
Not clear on what the question is, but...



In your selector, just check the value of each option against what you had

submitted.  If you are generating the select option list in a loop, then

it's pretty easy. Otherwise, you'll have to create an If..Else.. for each

option to check the value.  When you reach a value that matches what you

submitted, just add the 'selected' attribute to the option.



HTH,

Peter



-----Original Message-----

From: Adeola [mailto:aoadeyemo@h...]

Sent: Thursday, March 29, 2001 1:43 PM

To: ASP Web HowTo

Subject: [asp_web_howto] retaining value in a listbox after submittig





Hi everyone,

I'm trying to submit a page to itself whereby i have a listbox via the

select tag and once the user has selected an item they can submit the form.

The problem is, i want the value the user has selected to remain in place

without refreshing once submitted. This works fine using <iframe>, but i'm

not allowed to use that.

Please help.

Ade'



Message #3 by "Adeola" <aoadeyemo@h...> on Fri, 30 Mar 2001 19:06:34
>Thanx Peter,

I'll try what you said.

Just to clarify the question. I have a listbox which is hard coded.

<form>

<select name=txt"">

<option value=0>trade</option>

<option value=1>personal</option>

</select>

<input type = submit value = submit>

</form>



On submitting form 'noname' i want the value chosen to remain visible 

without changing to the default. I hope this is clearer.



Thanx

Ade'









 

Not clear on what the question is, but...

> 

> In your selector, just check the value of each option against what you 

had

> submitted.  If you are generating the select option list in a loop, then

> it's pretty easy. Otherwise, you'll have to create an If..Else.. for each

> option to check the value.  When you reach a value that matches what you

> submitted, just add the 'selected' attribute to the option.

> 

> HTH,

> Peter

> 

> -----Original Message-----

> From: Adeola [mailto:aoadeyemo@h...]

> Sent: Thursday, March 29, 2001 1:43 PM

> To: ASP Web HowTo

> Subject: [asp_web_howto] retaining value in a listbox after submittig

> 

> 

> Hi everyone,

> I'm trying to submit a page to itself whereby i have a listbox via the

> select tag and once the user has selected an item they can submit the 

form.

> The problem is, i want the value the user has selected to remain in place

> without refreshing once submitted. This works fine using <iframe>, but 

i'm

> not allowed to use that.

> Please help.

> Ade'

> 


  Return to Index