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

Submitting hidden and textbox values in a form with javascript??

Status
Not open for further replies.

leoney

Technical User
Jun 20, 2002
9
CA
How can I get a javascript to submit the Textbox entry and the Hidden values of my form?

This is my form:

<form name=&quot;librarian&quot; action=&quot; method=&quot;get&quot; target=&quot;results&quot;>
Drawing Number:
<br>
<input type=&quot;TEXT&quot; name=&quot;VALUE&quot; size=&quot;17&quot;>
<br>
<input type=&quot;HIDDEN&quot; name=&quot;TOPBRANCH&quot; value=&quot;ADAB&quot;>
<input type=&quot;HIDDEN&quot; name=&quot;TNS&quot; value=&quot;centra&quot;>
<input type=&quot;HIDDEN&quot; name=&quot;ATTRID&quot; value=&quot;7&quot;>
<input type=&quot;SUBMIT&quot; name=&quot;submitButton&quot; value=&quot;Find!&quot;>
</form>
 
it should submit all form fields.
That is your cgi should read all of them. What is the cgi performing?
action=&quot;
recommend changing method to POST also I may not get it the 1st or 2nd time,
but how sweet that 15th time can be.
 
The CGI that I am running searches an oracle database and returns mutliple feedback variables depending on the data entered in the text box. Does this help? I have tried everything and can't get my javascript to work.

Thanks for your help!
 
what is the script you
are refering to perform (the javascript) can you post the code.
Did you try and change to the POST method in the form tag?

javascript doesn't do the submiting. the cgi reads the form fields the browser passes. The problem is either the method or the search.exe
I may not get it the 1st or 2nd time,
but how sweet that 15th time can be.
 
the javascript that I am using is simply a submit object:

<SCRIPT LANGUAGE=&quot;Javascript&quot;>
function enterButton() {
document.librarian.submit()
}
</SCRIPT>

and then I call it from the text box input tag using the following:

<input type=&quot;TEXT&quot; name=&quot;VALUE&quot; size=&quot;17&quot; onUnfocus=&quot;enterButton&quot;>

What I get back is:

QUERY_STRING:ATTRID not found

I did try to change the method to post with no luck.

Thanks again... my first born is all yours... No... really... you can have him.
 
this may be a oversight but
<input type=&quot;TEXT&quot; name=&quot;VALUE&quot; size=&quot;17&quot; onUnfocus=&quot;enterButton&quot;>

needs to be

<input type=&quot;TEXT&quot; name=&quot;VALUE&quot; size=&quot;17&quot; onUnfocus=&quot;enterButton()&quot;>
I may not get it the 1st or 2nd time,
but how sweet that 15th time can be.
 
Try this:

Change the type=SUBMIT to
type=&quot;BUTTON&quot; and add
an OnClick=&quot;enterButton()&quot;
like
Code:
<INPUT type=&quot;Button&quot; Value=&quot;Press to search&quot; OnClick=&quot;enterButton()&quot;>

Then remove the onUnFocus method from the text box...
As an option ( to make additions easier and to reduce typing, you could also modify the function to:
Code:
<SCRIPT LANGUAGE=&quot;Javascript&quot;>
   function enterButton(form) {
   
    form.submit()
   }
   </SCRIPT>
To use this method, revise the OnClick method listed above to:
Code:
OnClick=&quot;enterButton(this.form)&quot;
Just a thought...

[profile]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top