Confused by this. I'm using a viewscript for a form. The echo statements in
the following code output in the wrong order if there is a validation error:
<?php
for($i=0;
$i<$this->element->promo_num->getValue(); $i++){
if(isset($this->element->{'promo_code_'.$i})){
$p =
$this->element->{'promo_code_'.$i};
$d =
$this->element->{'delete_'.$i};
//all the following output the
wrong html if there is an error
echo '
'.$p.$d.'
';
echo '
'.$this->element->{'promo_code_'.$i}.$this->element->{'delete_'.$i}.'
';
echo '
'; echo $this->element->{'promo_code_'.$i}; echo
$this->element->{'delete_'.$i}; echo '
';
}
}?>
With a validation error, the paragraph opening and closing tags are
generated before the error message and elements, so they fall out of the p
tag. This is the html generated
Value is required and can't be empty
Value is required and can't be empty
Value is required and can't be empty
I am prepending errors so the messages are in the right place relative to
the inputs but they all fall out of the p tags. The inputs are also being
generated via jquery and added to the form along the lines of
http://www.jeremykendall.net/2009/01/19/dynamically-adding-elements-to-zend-form/
http://www.jeremykendall.net/2009/01/19/dynamically-adding-elements-to-zend-form/
except that I am not setting an order value for the newly added elements.
Any help would be gratefully appreciated, I'm stumped.
--
View this message in context:
http://zend-framework-community.634137.n4.nabble.com/Echo-outputs-in-wrong-order-when-element-has-errors-form-viewscript-tp3424030p3424030.html
Sent from the Zend Framework mailing list archive at Nabble.com.
--
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]