-
Notifications
You must be signed in to change notification settings - Fork 2.5k
isValid sets up old values? #6645
Comments
have you try $data = $form->getData();
echo $data['element']; ? |
Hello samsonasik! I need to pass $form with new values to my template to show input field with formElement method. PS: There is no that problem in ZF 2.3.1. Thanks! |
@alexd5 yeah, I think it is a bug |
Just tested with ZF 2.3.2 and my own forms and I think you simply forgot something in your view script: $this->form->prepare(); When I leave out that line I get exactly what you describe and values are not remembered. Please see if you have that line in your view script. |
Hmmm... Thank you! |
Looking at your code, you are using the example from the manual. I tested it with that exact code and it works fine for me with ZF 2.3.2. I can confirm your comments in the code in your opening post. If for some reason you need if ($form->isValid()) {
$this->getAlbumTable()->saveAlbum($album);
// form elements ($form->get('element')) get old values !
$form->prepare();
// form elements ($form->get('element')) get NEW values !
return $this->redirect()->toRoute('album');
} It does not look like a bug to me, but it looks like you use the form in an incorrect way. |
Martin, Warm regards, Abdul Malik Ikhsan Pada 8 Sep 2014, pukul 05.36, Martin-P notifications@github.com menulis: |
If saveAlbum() and redirect() is commented, then the issue showed. Warm regards, Abdul Malik Ikhsan Pada 8 Sep 2014, pukul 05.36, Martin-P notifications@github.com menulis:
|
PR #6295 introduced this bug. The line |
Nice, thanks. |
@Martin-P thanks, closing. |
Hello!
Strange work of isValid method in ZF 2.3.2. I have added comments.
The text was updated successfully, but these errors were encountered: