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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

referencing a text box

Status
Not open for further replies.

MillsRJ

Technical User
Sep 14, 2002
28
CA
what is the proper syntax for a form text box to reference itself (to pass value on to a function or sub)

example

<input name=&quot;day1&quot; type=&quot;text&quot; id=&quot;day1&quot; onChange=&quot;<%call Changebox(newvaluehere,-13,qryElements.Fields.Item(&quot;numsubcatagoryid&quot;).Value)%>&quot; size=&quot;5&quot;>

When the user changes the value in the textbox, I wish to pass the new value to a function(along with some other arguements).

Am I calling the function correctly? (it is VBscript)

All my users are on IE6, the backend is SQL.

I did ask a similar question on another thread, but I think I made it too complicated.

thanks



Rob Mills
System Analyst
Correctional Services Canada
(all statements are my own ...., ah hell, its the government, sue'em anyway)
 
try document.formname.fieldname.value()
example, if you have a form named &quot;submit&quot; and a text field named first_name, then your passed value would looke like this
document.submit.first_name.value(). This will give you the value of the text field. Hope this is what you are looking for.
 
ok, I tried

onChange=&quot;Changebox(document.form1.day1.value(),-13,<%=qryElements.Fields.Item(&quot;numsubcatagoryid&quot;).Value%>)&quot;

but I get an error on page

the changbox function is as follows

<%
sub ChangeBox(newnum,dayspan,subcat)
dim addSQL,modSQL,curnum,subsite,lookdate
response.Write(&quot;newnum = &quot;&newnum&&quot;, dayspan = &quot;&dayspan&&quot;, subcat=&quot;&subcat)
if newnum = 0 or newnum = &quot;&quot; then
exit sub
end if
subsite = request.Form(&quot;subcategoryselect&quot;)
curnum = finddate(dayspan,subcat)
lookdate = dateadd(&quot;d&quot;,dayspan,request.form(&quot;datebox&quot;))
if curnum = 0 then
'add new record
addSQL = &quot;Insert into dbo.tblData (numSubCatagoryID,dtDate,flgLocked,numEntry,numSubSiteID) &quot;
addSQL = addSQL & &quot;VALUES (&quot;&subcat&&quot;,'&quot;&lookdate&&quot;',0,&quot;&newnum&&quot;,&quot;&subsite&&quot;) &quot;
end if
end sub
%>

thanks for the help

Rob Mills
System Analyst
Correctional Services Canada
(all statements are my own ...., ah hell, its the government, sue'em anyway)
 
it just says &quot;error on page&quot; at the bottom of the screen

Rob Mills
System Analyst
Correctional Services Canada
(all statements are my own ...., ah hell, its the government, sue'em anyway)
 
Thanks for your help all, but I've abandoned this idea for a form post method

cheers

Rob Mills
System Analyst
Correctional Services Canada
(all statements are my own ...., ah hell, its the government, sue'em anyway)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top