Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inserting text on pull down menu

Status
Not open for further replies.

BenRussell

Programmer
Mar 12, 2001
243
US
I have a ticket system that I am making (In perl) but I want people to be able to choose what kind of ticket it is in a pull down menu, and then depending on what they choose, the TEXTAREA below it will display a certain text (Like "You have chosen a high priority ticket, you will only need to enter This" or "You have chosen a low priority ticket, please enter This this and this").

Could you tell me how to do this? - Ben Russell
- President of Intracor Technologies (
 
So the form is submitted - and the choice takesn from the
select box - right? And then your PERL script loads a text file describing the ticket?

If there is not too many - you could load them all at once, and let client side JavaScript display the right one.

Or is the user then prompted to enter more info?

So what exactly are you trying to do?

BB
 
Ben,

You can do something like this...

function describeTicket(form_obj) {

if(form_obj.ticketlist.options[form_obj.ticketlist.selectedIndex].value == "1") {
form_obj.descr.value = "Description if option #1 is selected"
}

if(form_obj.ticketlist.options[form_obj.ticketlist.selectedIndex].value == "2") {
form_obj.descr.value = "Description if option #2 is selected"
}

// and so on...

}

<form>
<select name=&quot;ticketlist&quot; onChange=&quot;describeTicket(this.form);&quot;>
<option value=&quot;1&quot;>Ticket Type #1</option>
<option value=&quot;2&quot;>Ticket Type #2</option>
<!-- AND SO ON .. -->
</select>
<textarea name=&quot;descr&quot;></textarea>
</form>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top