forms using keyPress onChange to submit or not to submit

A

awebguynow

to submit or not to submit - that is the question
and I'm going to be designing some lengthy forms, where many of the
fields may be populated with data, and the user may only want to view
it.

In a perfect world, I'd have 2 buttons: Close and Submit - disabled
and Submit would become enabled - immediately - if data was changed.
otherwise the user could click "Close" and a php script could redirect
(header) to Default pg.

Any articles on this ? Has any one attempted this ? have advice ?
 
D

Danny

<input ....
onkeypress="this.form.MYSUBMIT.disabled=false;this.onkeypress=null;">

<input type="submit" disabled name="MYSUBMIT">

afterwards enabling MYSUBMIT, it removes itself, to avoid any
further keypress checks once the typing started, no point checking
each time.


Danny
 
A

awebguynow

Thank you for your response.
My only concern is that this may be cumbersome to code with 30+ input
fields.
Is there a good way to apply this to the whole form ?
 
T

Thomas 'PointedEars' Lahn

awebguynow said:
Thank you for your response.

Which response?

<URL:http://jibbering.com/faq/faq_notes/pots1.html#ps1Post>
My only concern is that this may be cumbersome to code with 30+ input
fields.
Is there a good way to apply this to the whole form ?

The `keypress' event is documented (in MSDN) and tested (in Mozilla/5.0
rv:1.8) to bubble:

<form ...
onkeypress="this.elements['MYSUBMIT'].disabled = false;
this.onkeypress = null;">
...
</form>

<URL:http://msdn.microsoft.com/workshop/author/dhtml/reference/events/onkeypress.asp>


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top