ZF-7571: Selectbox validation problem with ajax
Description
I have a validation problem with selectboxes which are creating dynamically by ajax. The static ones are working perfect. Is selectbox 0 value valid for Zend Validator? My 0 value is "Please Select" and I should use it. Or any thing else? How can I fixed this problem ? Is it a bug I don't know exactly.
Can anyone help me
Thanks
Deniz
I solve this problem by manually checking the selectboxes like;
if($formValues['productid'] == 0)
{ $errors .="You should select a product
"; }
Please make a solution with this problem.. I cannot use Zend required or validators!!
Thanks
Comments
Posted by Deniz Vatan (denizvtn) on 2009-08-16T23:13:31.000+0000
I solve this problem by manually checking the selectboxes like;
if($formValues['productid'] == 0) { $errors .="You should select a product
";
}
Please make a solution with this problem.. I cannot use Zend required or validators!!
Thanks
Posted by Thomas Weidner (thomas) on 2009-08-20T04:05:14.000+0000
I don't see a problem.
When you want to validate if a value is not empty then use the NotEmpty validator. It does the same as php's empty check and accepts 0 as empty.
Posted by Deniz Vatan (denizvtn) on 2009-08-20T06:36:31.000+0000
I tired NotEmpty validator but it doesnt work again. The ajax created selectboxes didn't work.
like this
$selectBoxHtml = "Please Select....";
The please select option should not be valid. But your validators say valid for 0 option.
Posted by Altaf Samnani (altaf) on 2010-01-29T23:14:37.000+0000
u cn add setMultiOptions ( array(' '=>'----please select----'); instead setMultiOptions ( array('0'=>'----please select----'); it will work :)