954,598 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Confused!! how to automatically populate a field

Okay what I've got is a form and an array with a list of courses. The array populates a drop down list, I also have on the form a cost text box. What I would like is when the user chooses a course the cost field to automatically bring the price that matches the course (without clicking on any buttons). I am trying to do this in classic ASP and cannot use Javascript.

Can someone please help me....thanks

akhtarr
Newbie Poster
3 posts since Mar 2009
Reputation Points: 10
Solved Threads: 0
 

compare dropdownlist.selecteditem to the course and fiil in the text box.check the command cause am not quit sure about it but it must be similar to it.

s1986
Light Poster
26 posts since Feb 2008
Reputation Points: 10
Solved Threads: 1
 

Okay what I've got is a form and an array with a list of courses. The array populates a drop down list, I also have on the form a cost text box. What I would like is when the user chooses a course the cost field to automatically bring the price that matches the course (without clicking on any buttons). I am trying to do this in classic ASP and cannot use Javascript.

Can someone please help me....thanks

populate the list....
post the form back to the same page with value from the list
and get the value corresponding to the list value using sql query....
i am working on the code...

aashishn86
Junior Poster
188 posts since Jun 2008
Reputation Points: 10
Solved Threads: 9
 


Originally posted by aashishn86
populate the list....
post the form back to the same page with value from the list
and get the value corresponding to the list value using sql query....
i am working on the code...

The only thing is I have not stored courses in a database they are in an array.

akhtarr
Newbie Poster
3 posts since Mar 2009
Reputation Points: 10
Solved Threads: 0
 

That's fine that courses are in an array, but where are the cost stored.

Moreever, if you want to do something on user selection, then either you will need to post your page back to server or you will need to use AJAx.

vicky_rawat
Junior Poster
137 posts since Jun 2008
Reputation Points: 28
Solved Threads: 19
 

Hi akhtarr, if you have physically entered the courses to an array, then create a multi-dimenion array which means you just add the value of the course into the array as you would normally do only now you are adding another value to it.

i.e.

dim arrayName()
' only necessary if drawn from database 
redim arrayName(course_number)

' add the values
arrayName(0) = course_name1 & "," & course_price1
arrayName(1) = course_name2 & "," & course_price2


You can retrieve these values in the same fashion as you would to populate the drop down box (select statement).

TomBCullen
Newbie Poster
10 posts since May 2009
Reputation Points: 10
Solved Threads: 2
 

Hi TomBCullen
Thanks Your post was really helpful! I have created a multi dimensional array and it is working. Thank you very much!!

akhtarr
Newbie Poster
3 posts since Mar 2009
Reputation Points: 10
Solved Threads: 0
 

Your welcome, I am glad to help.

If there are any more issues you need assistance with, just let me know.

TomBCullen
Newbie Poster
10 posts since May 2009
Reputation Points: 10
Solved Threads: 2
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You