|
ffff - 2007-07-21 23:34:47
For some strange reason the ValidationClientFunction, if applied to a hidden field, does not work as expected in internet explorer (tested in IE 6 and IE 7).
Here is what happens:
If some other field has errors, then the form marks the field errors and the hidden field errors too. BUT, if just the hidden fields have errors then the form is submitted normally (even though it should not submit) and no alert dialog is presented. The error is not within teh validation function because I tested if with a validation function that always returns false.
This only happens in IE (in firefox it does work correctly).
It is a really weird problem and I have no clue what could it be causing it. I think it should be in the javascript in charge of validation..
Manuel Lemos - 2007-07-22 01:57:45 - In reply to message 1 from ffff
This is confusing. First you mention ValidationServerFunction and then you say ValidationClientFunction. Are you sure you are not using the wrong parameters?
I would need to see a minimal example to understand what you are experiencing.
ffff - 2007-07-22 15:50:32 - In reply to message 2 from Manuel Lemos
I am sorry, I mean: ValidationClientFunction (javascript function executed on the client side to see if the form can be submitted).
Try adding a "ValidationClientFunction" to a hidden field. Then in the function put the following code:
{
return false;
}
(or any other js code that returns false). As you would be able to see, the form would submit even if the function s returning false. BUT if other field (like a text field) has other client validation function and it is also returning false, then the javascript alert will show both alert messages (the texfield not correct message and the hidden field message). If all fields validate exept the hidden fields then the form is submitted as if the hidden fields were valid. It is very strange because on firefox it works correctly but in internet explorer it does not work.
Manuel Lemos - 2007-07-22 21:23:01 - In reply to message 3 from ffff
Can you provide a minimal example form script that exhibits that behavior?
ffff - 2007-07-22 22:49:27 - In reply to message 4 from Manuel Lemos
Ok, here is how you can test it in less than 1 minute:
Take the "test_form.php" file included in the package.
1) Change the doit field declaration to:
$form->AddInput(array(
"TYPE"=>"hidden",
"NAME"=>"doit",
"VALUE"=>1,
"ValidationClientFunction"=>'testDoit',
"ValidationClientFunctionErrorMessage"=>'error in doit field'
));
2) in the <head> of the page add the following code:
<script language="javascript">
function testDoit() {
return false
}
</script>
Now, when you test the page and try to submit the form you get all the validation errors including "error in doit field", but if you fill all the form fields the form will submit even though the doit field validation is evaluating to false. If you access the same page in firefox the form will not let you submit it.
Manuel Lemos - 2007-08-02 17:59:25 - In reply to message 5 from ffff
There is a problem with Internet Explorer. It supports the focus function for hidden field but it throws an error. That is way the form is submitted without further validation.
I need to fix the class to avoid generating Javascript that gives the focus to hidden fields, as it does not make sense but I am away from my office now. I will look into that in a couple of weeks or so.
ffff - 2007-08-03 03:14:00 - In reply to message 6 from Manuel Lemos
Ok. Please let me know when the code is corrected.
|