943,916 Members | Top Members by Rank

Ad:
  • ASP Discussion Thread
  • Marked Solved
  • Views: 1941
  • ASP RSS
Mar 3rd, 2009
0

Confused!! how to automatically populate a field

Expand Post »
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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
akhtarr is offline Offline
3 posts
since Mar 2009
Mar 3rd, 2009
0

Re: Confused!! how to automatically populate a field

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.
Reputation Points: 10
Solved Threads: 1
Light Poster
s1986 is offline Offline
26 posts
since Feb 2008
Mar 4th, 2009
0

Re: Confused!! how to automatically populate a field

Click to Expand / Collapse  Quote originally posted by akhtarr ...
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...
Reputation Points: 10
Solved Threads: 9
Junior Poster
aashishn86 is offline Offline
184 posts
since Jun 2008
Mar 4th, 2009
0

Re: Confused!! how to automatically populate a field


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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
akhtarr is offline Offline
3 posts
since Mar 2009
Apr 18th, 2009
0

Re: Confused!! how to automatically populate a field

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.
Reputation Points: 28
Solved Threads: 19
Junior Poster
vicky_rawat is offline Offline
137 posts
since Jun 2008
May 20th, 2009
0

Re: Confused!! how to automatically populate a field

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.
ASP Syntax (Toggle Plain Text)
  1. dim arrayName()
  2. ' only necessary if drawn from database
  3. redim arrayName(course_number)
  4.  
  5. ' add the values
  6. arrayName(0) = course_name1 & "," & course_price1
  7. 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).
Reputation Points: 10
Solved Threads: 2
Newbie Poster
TomBCullen is offline Offline
10 posts
since May 2009
Jun 2nd, 2009
0

Re: Confused!! how to automatically populate a field

Hi TomBCullen
Thanks Your post was really helpful! I have created a multi dimensional array and it is working. Thank you very much!!
Reputation Points: 10
Solved Threads: 0
Newbie Poster
akhtarr is offline Offline
3 posts
since Mar 2009
Jun 2nd, 2009
0

Re: Confused!! how to automatically populate a field

Your welcome, I am glad to help.

If there are any more issues you need assistance with, just let me know.
Last edited by TomBCullen; Jun 2nd, 2009 at 11:23 am.
Reputation Points: 10
Solved Threads: 2
Newbie Poster
TomBCullen is offline Offline
10 posts
since May 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP Forum Timeline: combo box error validation
Next Thread in ASP Forum Timeline: drop down lists which displays a text box when a selection is made





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC