944,030 Members | Top Members by Rank

Ad:
Dec 23rd, 2005
0

Is it possible to submit form values using JavaScript? How?

Expand Post »
Can any one explain me how to submit form value using JavaScript?
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ksknagaprasad is offline Offline
1 posts
since Dec 2005
Dec 23rd, 2005
1

Re: Is it possible to submit form values using JavaScript? How?

Use the "submit" method of the Form object. You should always give your form an ID:

JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <form id="myForm" action="myServerSideCode.php" method="post"></form>

Then, you can reference and submit the form with a script that looks like:

JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. document.getElementById("myForm").submit();
Team Colleague
Reputation Points: 227
Solved Threads: 37
Made Her Cry
tgreer is offline Offline
1,697 posts
since Dec 2004
Jan 4th, 2006
0

Re: Is it possible to submit form values using JavaScript? How?

It is possible to do much more than this. You can build your entire http send or post response, with message and header fields. And you can do it reasonably quickly using html DOM traversal by element type (which you can call on any html element or the html body element) and you can process the content of the elements using browser methods to make them URI compatible.

However you will need to build server side functionality to translate this. Alternatively you can build a client-side translator in JavaScript, but this is only efficient with small form elements (with content less than 250 characters).

This approach is very useful if you have a specific reason for it, but it is much more complicated than the technique described by Thomas.
Reputation Points: 20
Solved Threads: 5
Junior Poster
alpha_foobar is offline Offline
182 posts
since May 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JavaScript / DHTML / AJAX Forum Timeline: I need help with my website. Using Dreamweaver.
Next Thread in JavaScript / DHTML / AJAX Forum Timeline: Remove Selected Value from the Text Area





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC