I.T. Discussion Community!
-Collapse +Expand
JavaScript
Search JavaScript Group:

Advanced
-Collapse +Expand JavaScript Store

Prestwood eMagazine

July Edition
Subscribe now! It's Free!
Enter your email:

   ► MB LobbyJavaScript and AJAX BoardJavaScript Topic   All Groups   Print This   

Submitting a Form Using a Script

Submitting a Form Using a Script in JavaScript topic (part of our JavaScript and AJAX group).

Quick Search: Submitting   Submitting Form   Submitting Form Using  

Walt
I am wanting to submit a form's hidden values with a script. I wrote a function:
function send(){
form_name.submit()
}

Then I put onUnLoad="send()" in the BODY tag and it doesn't give the desired results.

I need to post the values in the hidden fields to any page's link in my site that is clicked. My objective is to let the page forward the fields to the next page without the user having to click a submit button.

Any help will be greatly appreciated, thanks.

Walt
 Posted 13 years ago (Thread Starter)
Comment Quote
Location=-- USA,  Joined=13 years ago   MB Posts=1  
More... -Collapse +Expand
Walt
-- USA
Rank: Cadet 2nd Year
Approved member.
Member subscribes to this thread with a verified email.
Old Account!
If this is your account, sign in to activate web presence data (sign in quarterly to keep active). Alternatively, you can subscribe to our monthly eMag with a valid email address.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #2850, 3 replies
Thread Started 7/4/2001 9:43:00 PM
View Counter=2031
Last Reply Posted 7/10/2001 10:42:00 AM)
Most Recent Post

Larry J. Rutledge
To prevent code from being translated to HTML, you treat it the same way you would when displaying HTML code from within a HTML page. For example, to display <HTML> you enter an ampersand (&) followed by lt; then enter "HTML" and finally, another ampersand (&) followed by gt;. So the text to enter would be:

& lt;HTML& gt;

but without the spaces. The "lt" stands for "Less Than" and the "gt" stands for "Greater Than".

So the code in the preceeding message should appear as follows:

<html>
<script language="JavaScript">
function send() {
alert("enter the onunload function");
document.forms[0].submit();
}
</script>

<body onunload="send()">
<p>exit page to test onunload.
<p>
<a href=javascript.document.forms[0].submit()">Manual Submit</a>

<form name="hiddenform" action="http://www.kimberry.com/cgi-bin/echo.cgi">
<input type=hidden name="hidden1" value="33333333">
</form>
</body>
</html>

I hope this helps for future posts.
Larry
Larry J. Rutledge

Analyst

Prestwood Software

www.prestwood.com
 Posted 13 years ago
Comment Quote
Location=Citrus Heights, CA USA,  Joined=14 years ago   MB Posts=74   KB Posts=9  
More... -Collapse +Expand
Larry J. Rutledge
Prestwood IT
Citrus Heights, CA USA
Rank: Lieutenant-Commander
Approved member.
Member subscribes to this thread with a verified email.
About Larry J. Rutledge
I worked for Prestwood Software as a Delphi developer from 1997 through 2002. During that time I enjoyed working with Mike Prestwood and the other developers at Prestwood.

Post ID #2939 (Level 1.1)  Reply to 2850
Thread Started 7/10/2001 10:42:00 AM
View Counter=2

Kim Berry
Walt,

I wrote the following to test what is happening. If I manually execute the "send" the form.submit() occurs and the browser goes to the action page.

But if I execute the form.submit by leaving the page to trigger the onunload(), the page I am going to seems to take precidence.

I think to pass hidden fields you must enter the page as the submit action. Will using the HREF example I used work for you?

{NOTE: I could not post html tags, so remove the "XXX" to use this page. Also it made me remove parenthesis, so PP is open/close parens.]

Kim

 
< !--




function sendPP{
alert("enter the onunload function");
document.forms[0].submitPP;
}





exit page to test onunload.


Manual submit








-->

--
Kim Berry
Senior Programmer Analyst

 Posted 13 years ago
Comment Quote
Location=Citrus Heights, CA USA,  Joined=12 years ago   MB Posts=65   KB Posts=19  
More... -Collapse +Expand
Kim Berry
Prestwood IT
Citrus Heights, CA USA
Rank: Commander
Approved member.
Member subscribes to this thread with a verified email.
About Kim Berry

Kim Berry is an experienced coder currently specializing in VS.Net C# coding of WinForm and WebForm applications. Kim currently works part time for Prestwood IT Solutions and participates in this online community when time allows. Kim worked fulltime at Prestwood Software for four years and is still available for part time evenings and weekends work. He was one of the main Prestwood developers developing ASPSuite and has coded in many languages including C, Visual Basic, Delphi, and Visual Studio.Net.


Post ID #2864 (Level 1.2)  Reply to 2850
Reply Posted 7/5/2001 9:12:00 AM

Kim Berry
Walt,

In spite of my best efforts last time, the code translated to HTML, so my "Code" is not visible. I'll try a second method:

less-than is [[[
greater than is ]]]

if this works I'll see about adding to the instructions on how to post HTML code.

Kim


 
[[[Html]]]

[[[script language="javascript"]]]

function send(){
alert("enter the onunload function");
document.forms[0].submit();
}
[[[/script]]]


[[[body onunload="send()"]]]

[[[p]]]exit page to test onunload.

[[[p]]]
[[[A href=javascript.document.forms[0].submit()"]]]Manual submit[[[/a]]]


[[[form name="hiddenform" action="http://www.kimberry.com/cgi-bin/echo.cgi"]]]
[[[input type=hidden name="hidden1" value="33333333"]]]
[[[/form]]]

[[[/body]]]
[[[/html]]]

--
Kim Berry
Senior Programmer Analyst

 Posted 13 years ago
Comment Quote
Location=Citrus Heights, CA USA,  Joined=12 years ago   MB Posts=65   KB Posts=19  
More... -Collapse +Expand
Kim Berry
Prestwood IT
Citrus Heights, CA USA
Rank: Commander
Approved member.
Member subscribes to this thread with a verified email.
About Kim Berry

Kim Berry is an experienced coder currently specializing in VS.Net C# coding of WinForm and WebForm applications. Kim currently works part time for Prestwood IT Solutions and participates in this online community when time allows. Kim worked fulltime at Prestwood Software for four years and is still available for part time evenings and weekends work. He was one of the main Prestwood developers developing ASPSuite and has coded in many languages including C, Visual Basic, Delphi, and Visual Studio.Net.


Post ID #2865 (Level 1.3)  Reply to 2850
Reply Posted 7/5/2001 9:19:00 AM

Revive Thread!

Add a comment to revive this old thread and make this archived thread more useful.

Write a Comment...
Full Editor
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.


Anonymous Post:

Enter your name and security key.

Your Name:
Today's security key = P234A
Enter key:
Icon: A Post    Thread    Idea    Important!    Cool    Sad    No    Yes    Includes a Link...   
Thread #2850 Counter
2031
Since 4/2/2008
-
  Load Time=less than 1 second.
 
Print This


-
 
Have a question? Need our services? Contact us now.
--Mike Prestwood

Call: 916-726-5675

email: info@prestwood.com


541 People Online Now!!  
Sign In to see who's online now!  Not a member? Join now. It's free!
Show more stats...
Follow PrestwoodBoards on: 


©1995-2014 PrestwoodBoards  [Security & Privacy]
Professional IT Services: Coding | Websites | Computer Tech