send input to another page without using 'submit' button

Hello all

I have a page with some inputs. I need to send the input to another page or servlet (using form action='pageorservlet') but i want to do it without using the 'submit' button, but as a normal 'button'.

I do not want to submit a partially filled form by pressing the <enter> button anytime during data-entry, so I do not want to use 'submit' to continue to another page or servlet.

Is this possible ?

[447 byte] By [fazalba] at [2007-11-26 20:56:14]
# 1

What you actually want is a javascript script that will chech the form values and will not submit the form untill everythink is filled.

This script can be bound to the form using an onsubmit event like:

<form method="post" onsubmit="ValidateThisForm(this)">

put your form html here

</form>

I hope it helped

droumpa at 2007-7-10 2:24:28 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

hi,

you can write a java script that validates you form.. and call this function in your normal button through the onClick event. Now if the form's inputs are valid you can use

formName.action="/actionPath"

formName.submit();

to submit the page.. else if there is validation errors.. just return false so nothing happens when user click the button.

Hope this ans helps you

Thanks and Regards,

Abdel Olakara

http://olakara.googlepages.com

Olakaraa at 2007-7-10 2:24:28 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

Yes.. I know that you can have a javascript to validate. That is correct. I can do a validate() before. But I want to examine my original question of sending data in input boxes from a form to another page.

I have heard that in the 'action' of the form you can point to a javabean with getter/setter methods to pass inputs to another page (with an event handler). My query is can this be done using a button of type 'button', or even a hyperlink ?.

Thanks for all the replys so far.

fazalba at 2007-7-10 2:24:28 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
Olakara's answer was clear about it. Use the submit() method from your javascript and it will submit the form. you can attach this script to an onclick button of a norma button, a hiperlink or whatever u feel comfortable with.As i said, he already pointed it out.
benubacha at 2007-7-10 2:24:28 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5
Point taken.I will settle for this solution.Thanks to all for your comments.
fazalba at 2007-7-10 2:24:28 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...