For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > June 2006 > QuickForm this.form.submit(), errors don't show up









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author QuickForm this.form.submit(), errors don't show up
Mark Steudel

2006-06-19, 7:07 pm

I added a little javascript to my submit button to provide feedback to the
user when they submit a form, it also disables the submit butt. When I use
it, the errors in the below form don't show up, is it because I'm using the
javascript this.form.submit()? Why would it cause the errors not to show up?

Thanks, Mark

Example form

$form =& new HTML_QuickForm('testform');

// Creates a checkboxes group using an array of separators
$checkbox[] = & HTML_QuickForm::createElement('checkbox'
, 'A', null, 'A');
$checkbox[] = & HTML_QuickForm::createElement('checkbox'
, 'B', null, 'B');
$checkbox[] = & HTML_QuickForm::createElement('checkbox'
, 'C', null, 'C');
$checkbox[] = & HTML_QuickForm::createElement('checkbox'
, 'D', null, 'D');
$form->addGroup($checkbox, 'ichkABC', 'ABCD:', array(' ', '<br />'));

// At least one element is required
$form->addGroupRule('ichkABC', 'Please check at least two boxes',
'required', null, 2);

$form->addElement( 'submit', 'submitForm', 'Submit Form', array( "onclick"=>
"this.value='Submitting form please
wait...';this.disabled=true;this.form.submit();") );

Thanks, Mark
Mark Wiesemann

2006-06-19, 7:07 pm

Mark Steudel wrote:

> I added a little javascript to my submit button to provide feedback to the
> user when they submit a form, it also disables the submit butt. When I use
> it, the errors in the below form don't show up, is it because I'm using the
> javascript this.form.submit()? Why would it cause the errors not to show up?
>

[...]
> // At least one element is required
> $form->addGroupRule('ichkABC', 'Please check at least two boxes',
> 'required', null, 2);


To be a little bit more helpful than the other replies:

After the "2" there is something missing to make the code do that what
you expect ... (RFTM ;-))
http://pear.php.net/manual/en/packa...ddgrouprule.php

Regards,
Mark
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com