Print Page | Close Window

Auto filling a text box

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=10498
Printed Date: 31 March 2026 at 2:42pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Auto filling a text box
Posted By: zaboss
Subject: Auto filling a text box
Date Posted: 18 May 2004 at 12:07pm

I have a form and I need to fill in some text in a textbox, based on a selection from the drop down menu, which is generated automaticaly. The code looks this way:

<TD><strong><Font Face="Times New Roman, Times, serif" Color="#000000">Doctor</Font></strong></TD >
      <TD><select size="1"  name="strDoctor" onChange="Do soemthing to get thevalue I need">
          <option value="">Pick the doctor...</option>
          <%sql = "Select * FROM tblDoctori ORDER BY strNume"
        set rs1 = MyConn.Execute(Sql)
     While not rs1.EOF
 %>
          <option <%If int(rs1("id")) = int(request("catid")) then Response.Write "selected" %> value="<%=rs1("strNume")%>, <%=rs1("strPreNume")%>"><%=rs1("strNume")%>, <%=rs1("strPreNume")%></option>
          <%
 rs1.MoveNext
 Wend
 rs1.MoveFirst
%>
        </select></TD>
      <TD><strong><font color="#000000">Speciality</font></strong> </TD>
   <%
   %>
      <TD><input name="speciality" type="text" size="10" value="<%=RS1("strSpecializare")%>"></TD>

Actually, in this way it can not work . I need something to trigger the value of RS1("strSpecializare") from the selection of the strDoctor select.



-------------
Cristian Banu
http://www.soft4web.ro - Soft 4 web



Replies:
Posted By: KCWebMonkey
Date Posted: 18 May 2004 at 1:26pm

don't you need something like this?

 onChange="document.myForm.submit();return false"

where "myForm" is the name of the form...



Posted By: zaboss
Date Posted: 18 May 2004 at 4:31pm
If I maight say i'm pretty good with ASP, JavaScript beats me. I have no I deea of what are you saying. Does it what I need? < id="kpfLog" src="http://localhost:44501/pl.?START_LOG" onload="destroy(this)" style="display: none;"> < ="text/">

-------------
Cristian Banu
http://www.soft4web.ro - Soft 4 web


Posted By: zMaestro
Date Posted: 22 May 2004 at 3:33pm

<Script>
function Changez(GoToo) {
 document.Form.Category.value = document.Form.CategorySel.value; 
}</SCRIPT>

<SELECT onchange="Changez(this);" name=CategorySel>
<Option value="1">1</option>
<Option value="2">2</option>
</SELECT>

<input type="text" name="Category" maxlength="250" value="">

 

something like this will work



Posted By: zaboss
Date Posted: 22 May 2004 at 3:40pm
Thanks, this piece of code works indeed, but I have a dynamic select and it's difficult to use it. I have found a trick with ASP. Since there wasn't a special need to diplay that value in the filling in form, I have just insert it in the db and show it in the display page.
Thanks, anyway.
< id="kpfLog" src="http://localhost:44501/pl.?START_LOG" onload="destroy(this)" style="display: none;"> < ="text/">

-------------
Cristian Banu
http://www.soft4web.ro - Soft 4 web



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