On Tue, Feb 22, 2011 at 1:53 PM, Djonatan Buss <djonat...@gmail.com> wrote: > I'm using checkbox to check if the client agrees with the contract. > But I would like to have 'No' if it was not checked. > The problem is that I don't know how to change the hiddenField value. > Ok, I know that I can treat it before saving changing 0 for 'No', but I > would like to avoid this code and just set the value of the hiddenField to > 'No' > Do you know anything possible? or even if you can say "Theres no other way" > it will help. > Many thanks... > http://book.cakephp.org/view/1414/checkbox > http://book.cakephp.org/view/1651/options-hiddenField >
If the value of this element will be saved to the DB, you should leave it as it is. Changing booleans to be 'yes' or 'no' is invitingproblems down the road. If you want to display the result in human-readbale way, just use something like: echo ($data['Model']['field'] == 1 ? 'yes' : 'no'); You can even do that in afterFind, adding an extra "field" to the data array. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. 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