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!

Javascript help

Status
Not open for further replies.

rl435

Programmer
Apr 21, 2010
1
GB
Hi
I have a form on one page, that successfully passes text from a form page to another. With the code below, I can successfully process this information.

<FORM NAME="formname">
<form action=""><b>process:  </b><input id="processme" NAME="textname" type="text" size="20"><input value="Submit" onClick="processIndex(); return false;" type="submit">
</form>

How can I get the form to process itself automatically on loading, thus removing the need for a button?

Thanks
 
Your Form there does nothing more than call the processIndex() function. It won't submit anywhere, and it wont redirect anywhere. I'm assuming all that logic is inside processIndex().

With that said, if it automatically runs the processIndex function as you want it to, then the user can't actually type anything into the "textname" textbox. So there would be nothing to process.

But if you really don't need a button or Form or anything to be typed into the textbox, maybe just calling the processIndex() function from the onLoad event of the page may do what you want, however, then I see no point in actually having the page to begin with. But I guess that's another issue altogether.

Code:
<body onLoad="processIndex();">
...
</body>




----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Why not use jQuery and take advantage of the docready function. You could even use this with real form submission. The advantage of using docready over body onload is that it will fire as soon as the DOM is loaded and will result in quicker and generally more consistent execution.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top