Re: Form fields repopulating with default data.
I was using an input form with 'value' => ''. I changed it to "default => '' and it works like a charm. Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Form fields repopulating with default data.
Is your field a 'select' type? How are you setting the default value? >From memory, using 'selected'=>'value' forces the input view to show initial 'value', but using 'default'=>'value' will only populate 'value' if data is not present for that field - so in the case of failed validation (where data is returned to the view) the user- entered value will stand. On Jul 27, 11:54 pm, Shaun wrote: > I have a form field named user_first_name with no default value. When > a user named Fred completes this field correctly, but enters invalid > data in another field such as user_password, user_first_name is > automatically repopulated with "Fred" so Fred doesn't need to write > his first name again. Nice! > > However, I also have a form field named user_birth_year with a default > value of "". Fred enters a valid birth year, but an invalid > password. Rather than saving his correct birth year, the field is > automatically repopulated with "". > > How can this be avoided? Thanks. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Form fields repopulating with default data.
I have a form field named user_first_name with no default value. When a user named Fred completes this field correctly, but enters invalid data in another field such as user_password, user_first_name is automatically repopulated with "Fred" so Fred doesn't need to write his first name again. Nice! However, I also have a form field named user_birth_year with a default value of "". Fred enters a valid birth year, but an invalid password. Rather than saving his correct birth year, the field is automatically repopulated with "". How can this be avoided? Thanks. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---