470,855 Members | 1,270 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,855 developers. It's quick & easy.

PHP & Javascript insanity

So, I've been fighting with this for a day now and would love some help.

I am working on:
http://www.webaccessstrategies.com/c...enewalform.php
Because of the size of the form, users have been getting a bit trigger-
happy on the submit button.

I've found a method to disable the submit button, but now I have a problem
with my server-side validation.

The form submits to itself to do validation based on whether or not
$_REQUEST['submit'] isset.

The problem is that now that I have the javascript in place to disable the
button, $_REQUEST['submit'] is never getting set.

TIA for any guidance on what is causing this.

--
Karl Groves
http://karlcore.com
http://chevelle.karlcore.com
Apr 12 '06 #1
11 1387
On 12/04/2006 14:54, Karl Groves wrote:
I am working on:
http://www.webaccessstrategies.com/c...enewalform.php
Because of the size of the form, users have been getting a bit trigger-
happy on the submit button.
I'm not surprised. It's enormous! The first thing I'd suggest is
breaking it down into sections, and allow the user to move between them.
With a form that large, it might also be beneficial to allow the user to
save it in a partial state then log back in to resume at a later date.
I've found a method to disable the submit button, [...]
I suggest that you lose it again: it's not good for usability. Consider
what happens if the user has problems submitting and hits the back
button to try again. How do you propose they resubmit?

[snip]
The problem is that now that I have the javascript in place to disable the
button, $_REQUEST['submit'] is never getting set.


Disabled form controls are not successful; they don't become part of the
form data set.

Mike

--
Michael Winter
Prefix subject with [News] before replying by e-mail.
Apr 12 '06 #2
El Wed, 12 Apr 2006 08:54:03 -0500
Karl escribió:
The form submits to itself to do validation based on whether or not
$_REQUEST['submit'] isset.


well, you could just add a hidden field and check for it instead.

<input type="hidden" id="issubmiting" value="1"/>

and then in your code

if(isset($_POST['issubmiting'])&&$_POST['issubmiting']=='1')
{
//process the form
}

--
Juan José Gutiérrez de Quevedo
Director Técnico (ju****@iteisa.com)
ITEISA (http://www.iteisa.com)
942544036 - 637447953
Apr 12 '06 #3
Michael Winter <m.******@blueyonder.co.uk> wrote in
news:fV*****************@text.news.blueyonder.co.u k:
On 12/04/2006 14:54, Karl Groves wrote:

The problem is that now that I have the javascript in place to
disable the button, $_REQUEST['submit'] is never getting set.


Disabled form controls are not successful; they don't become part of
the form data set.


Ah, OK. So by disabling it, no value is passed. Dur. I should have known
better. Thanks for the response!
--
Karl Groves
http://karlcore.com
http://chevelle.karlcore.com

Accessibility Discussion List: http://smallerurl.com/?id=6p764du
Apr 12 '06 #4
Wow, i strongly recommend you asses what questions on that form
logically fit together and break it up into multiple pages. If i were
filling that out im pretty sure id go crazy. Even if it takes just as
long, having more susinct things can help usability.

Apr 12 '06 #5
Also, if this form is a renewal form for existing clients, why are you
having them re-enter all their information? Shouldn't you just show
them the information you have on file and ask for a confirmation?

I'd really hate to have to fill out this entire form every six months
when the only piece of information that has changed was my
symtoms/illness.

Also, consider client-side validation via jscript to compliment the
serverside validation.

-Robert

Apr 12 '06 #6
"Areric" <jo**********@gmail.com> wrote in news:1144851661.619216.39750
@u72g2000cwu.googlegroups.com:
Wow, i strongly recommend you asses what questions on that form
logically fit together and break it up into multiple pages. If i were
filling that out im pretty sure id go crazy. Even if it takes just as
long, having more susinct things can help usability.


I've already "strongly recommended it" to the client. They didn't want to
hear it.

--
Karl Groves
http://karlcore.com
http://chevelle.karlcore.com

Accessibility Discussion List: http://smallerurl.com/?id=6p764du
Apr 12 '06 #7
"rlee0001" <ro*********@hotmail.com> wrote in news:1144852867.175801.148370
@i39g2000cwa.googlegroups.com:
Also, if this form is a renewal form for existing clients, why are you
having them re-enter all their information? Shouldn't you just show
them the information you have on file and ask for a confirmation?

I'd really hate to have to fill out this entire form every six months
when the only piece of information that has changed was my
symtoms/illness.


Client required it.
There's only so many times you can say "I don't really think that's a good
idea", before you just throw your hands up and do what they ask.

--
Karl Groves
http://karlcore.com
http://chevelle.karlcore.com
Apr 12 '06 #8
Here's how I disable a button on submit

<input type="submit" onclick="PleaseWait(this)" />

the javascript is

function PleaseWait(button)
{
button.value='PLEASE WAIT';
button.style.color='red';
button.onclick= function() {
alert('Please Wait');
return false;
}
return true;
}

We also do server side checking for duplicate form posts on all forms
received.

Apr 13 '06 #9
fletch wrote:
Here's how I disable a button on submit

<input type="submit" onclick="PleaseWait(this)" />

the javascript is

function PleaseWait(button)
{
button.value='PLEASE WAIT';
button.style.color='red';
button.onclick= function() {
alert('Please Wait');
return false;
}
return true;
}

We also do server side checking for duplicate form posts on all forms
received.


You can't unless you send the page back to the client. Javascript is
client-side, while PHP is server-side.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Apr 13 '06 #10
Well, I do.

(client) form -> *submit* -> submit button disabled -> (server now)
form compared to previous forms -> form validated -> form saved to
session -> form processed or represented to user to fix (client again).
Javascript is client-side, while PHP is server-side.


yup.

Apr 13 '06 #11
An easy method of accomplishing this would be to have a hidden field
with the submit value and leave the button unnamed.

Apr 13 '06 #12

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

115 posts views Thread by Mark Shelor | last post: by
14 posts views Thread by Arne | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.