[QF] Changing the default javascript script
| From: | Mark Steudel | Date: | Tue, 10 Jan 2006 18:50:06 +0000 |
| Subject: | [QF] Changing the default javascript script | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-22490@lists.php.net to get a copy of this message | ||
Im trying to modify the main validation javascript:
return
"\n<script type=\"text/javascript\">\n" .
"//<![CDATA[\n" .
"function validate_" . $this->_attributes['id'] . "(frm,
verbose) {\n" .
" var verbose = (!verbose) ? 1 : 0;\n" .
" var value = '';\n" .
" var errFlag = new Array();\n" .
" var _qfGroups = {};\n" .
" _qfMsg = '';\n\n" .
join("\n", $test) .
"\n if (_qfMsg != '' && verbose) {\n" .
" _qfMsg = '" . strtr($this->_jsPrefix, $js_escape) .
"'
+ _qfMsg;\n" .
" _qfMsg = _qfMsg + '\\n" . strtr($this->_jsPostfix,
$js_escape) . "';\n" .
" alert(_qfMsg);\n" .
" return false;\n" .
" }\n" .
" return true;\n" .
"}\n" .
"//]]>\n" .
"</script>";
}
Basically all it's doing is supressing the alerts if I want. I want to be
able to run another script if the whole form passes validation:
function new_script()
{
var verbose = 0;
if ( validate_formname( formid, verbose ) )
{
do something here;
}
}
I copied the whole getValidationScript() script out of the QuickForm class
and thought perhaps I could extend the QuickForm class and some how tell my
form to use this function instead of it's default function. So now I'm not
really sure where to go from here.
Thanks in advance, Mark