Print Page | Close Window

populating an input textbox

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=12419
Printed Date: 30 March 2026 at 11:00pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: populating an input textbox
Posted By: simflex
Subject: populating an input textbox
Date Posted: 02 November 2004 at 11:42am

Hello all,

I have a dynamic dropdown list box which gets populated based on alue selected from another dropdown listbox.

  

  <td><SELECT Name="to_<%=row%>" size="1" onChange="document.MainForm.testtext.value = this.value;">
  <%
  'loop through recordset/array of all possible blocks
  For i = 0 To UBound(rows,2)
  if rows(COL_Block,i) = Block_ID  then
  response.write("<option selected value='" & rows(COL_To,i) & "'>" & rows(COL_To,i) & "</option>")
  else
    response.write("<option value='" & rows(COL_To,i) & "'>" & rows(COL_To,i) & "</option>")
  end if
  next
  %>
   </SELECT></td>
   <td><input type="text" name="testtext" size="30"></td>


Above code works fine so far.

I also have an input textbox that  I would like to have populated based on value selected from code above.

That is not working so far.

What we would like to do is have the ability to enter a value into the textbox if no value is found from the dropdown.

For instance, if we are given a list of values that are supposed to be on the dropdown value but one or more of those values are not found on the dropdown above, we will like to enter the value in the input textbox manually and then submit that value to the database

Is this possible?

I know that you *cannot* have an input text and a dropdown value with same form variable.

Thanks in advance

 

 




Replies:
Posted By: dpyers
Date Posted: 02 November 2004 at 1:08pm

Why not just use another name for the input text box?

Also, If when the user selects from the first drop-down, you go to the server to populate the second drop-down, you could just put a category of "OTHER" in the first drop-down. Then on the server, if there's a valuse of "OTHER", write the textbox, otherwise write the second drop down.



-------------

Lead me not into temptation... I know the short cut, follow me.


Posted By: simflex
Date Posted: 02 November 2004 at 2:08pm

hmm, nice idea.

Thanks, that will work.




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net