[fw-general] Zend_Form custom validator best practices
Hello All, I have a form with 2 fields and submit button. Form is created like this: $form = new Zend_Form(); $form->setMethod('post'); $form->addElement('text','field1', array( 'label' => 'User Name', 'required' => false )); $form->addElement('text','field2', array( 'label' => 'Secret Code', 'required' => false )); $form->addElement('submit','submit',array( 'label'=>'Submit' )); I need to validate the form like this: If a user submits the form with ALL empty fields the form should fail the validation, but if a user fills in AT LEAST ONE of two fields the validation should be successful. How should I set up the validation for this? Now I just check if at least one of the fields is filled in controller, and display the error message. But I was thinking may be there is a way to extend Zend_From or some validators for this purpose as I've got several forms like this. Thanks in advance for any help. -- View this message in context: http://www.nabble.com/Zend_Form-custom-validator-best-practices-tp19671713p19671713.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Multi Checkbox options escaping
Hello Everybody, I'm new to ZF and this was my first posting on this forum. I haven't got any reply to my question and I just wonder if anybody can help me out with this issue? Even the answer like: "There is no known possible solution to it" would help :) Thank you. cyrilkuch wrote: > > Hi, > > Is there any way to disable escaping for multicheckbox options ? > > I'm creating a multi checkbox element with linked options like this: > > $element = new Zend_Form_Element_MultiCheckbox('foo', array( > 'multiOptions' => array( > 'foo' => '<a href="#">Foo Option</a>', > 'bar' => '<a href="#">Bar Option</a>', > 'baz' => '<a href="#">Baz Option</a>', > 'bat' => '<a href="#">Bat Option</a>', > ); > )); > > When the multi checkbox is displayed links are escaped. > I tried to remove escaping for multi checkbox like this: > > $label = $element->getDecorator('label'); > $label->setOption('escape', false); > > but this applies only to multi checkbox's label but not to it's options. > > > Thank you. > -- View this message in context: http://www.nabble.com/Multi-Checkbox-options-escaping-tp18874104p18967504.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Multi Checkbox options escaping
Hi, Is there any way to disable escaping for multicheckbox options ? I'm creating a multi checkbox element with linked options like this: $element = new Zend_Form_Element_MultiCheckbox('foo', array( 'multiOptions' => array( 'foo' => 'Foo Option', 'bar' => 'Bar Option', 'baz' => 'Baz Option', 'bat' => 'Bat Option', ); )); When the multi checkbox is displayed links are escaped. I tried to remove escaping for multi checkbox like this: $label = $element->getDecorator('label'); $label->setOption('escape', false); but this applies only to multi checkbox's label but not to it's options. Thank you. -- View this message in context: http://www.nabble.com/Multi-Checkbox-options-escaping-tp18874104p18874104.html Sent from the Zend Framework mailing list archive at Nabble.com.