Re: error message on select box validation
I'm having a similar problem as you two and I found this thread after a quick search: http://groups.google.de/group/cake-php/browse_thread/thread/58c30b3c249dca19/501031b9492346ee?lnk=gstq=validation+message#501031b9492346ee It says you should use $form-input with type=select instead of the $form-select. (Alternatively you'd have to create labels and error messages for your select tag yourself.) I could not try this out yet but it seems to do what you want to be done. On 26 Okt., 10:38, ilozka [EMAIL PROTECTED] wrote: Don't use $form-select, use $form-input with type=select: echo $form-input('answer', array('type' = 'select', 'options' = array('0'='No', '1' = 'Yes'))); On Oct 20, 4:35 pm, clrockwell [EMAIL PROTECTED] wrote: Thank you David, I was hoping to avoid that and simply thought I was doing something wrong. Thanks! On Oct 19, 10:27 pm, David C. Zentgraf [EMAIL PROTECTED] wrote: If you use $form-input(), it will create everything for an input field, including label and error messages. If you use the more specialized select() you'll have to create labels and error messages yourself. See FormHelper::error(). http://api.cakephp.org/class_form_helper.html On 20 Oct 2008, at 07:49, clrockwell wrote: I'm using 1.2 and this is driving me crazy. I have a form with several fields that usevalidation. When I submit an empty form for testing all fields *except* the select have the appropriate html generated and the errormessageis displayed. The html for the select box begins with: label class=textOccupation*/labelselect name=data[Vip] [occupation_id] id=VipOccupationId On submitting without selecting anything, the html is this (class =form-error now present): label class=textOccupation*/labelselect name=data[Vip] [occupation_id] id=VipOccupationId class=form-error But there is no html generated below it. Dumping Model- invalidFields() shows: [occupation_id] = Please select the most appropriate occupation So it is definitely there. This happens on all select boxes. The code using to generate this one: label class=textOccupation*/label?php echo $form- select('Vip.occupation_id', $this-requestAction('/occupations/ occSelect', array('cache' = '1 week', 'label' = false, 'div' = false))); ?/span Thanks for any thoughts, I'm thinking this may be a bug. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: error message on select box validation
Don't use $form-select, use $form-input with type=select: echo $form-input('answer', array('type' = 'select', 'options' = array('0'='No', '1' = 'Yes'))); On Oct 20, 4:35 pm, clrockwell [EMAIL PROTECTED] wrote: Thank you David, I was hoping to avoid that and simply thought I was doing something wrong. Thanks! On Oct 19, 10:27 pm, David C. Zentgraf [EMAIL PROTECTED] wrote: If you use $form-input(), it will create everything for an input field, including label and error messages. If you use the more specialized select() you'll have to create labels and error messages yourself. See FormHelper::error(). http://api.cakephp.org/class_form_helper.html On 20 Oct 2008, at 07:49, clrockwell wrote: I'm using 1.2 and this is driving me crazy. I have a form with several fields that use validation. When I submit an empty form for testing all fields *except* the select have the appropriate html generated and the error message is displayed. The html for the select box begins with: label class=textOccupation*/labelselect name=data[Vip] [occupation_id] id=VipOccupationId On submitting without selecting anything, the html is this (class =form-error now present): label class=textOccupation*/labelselect name=data[Vip] [occupation_id] id=VipOccupationId class=form-error But there is no html generated below it. Dumping Model- invalidFields() shows: [occupation_id] = Please select the most appropriate occupation So it is definitely there. This happens on all select boxes. The code using to generate this one: label class=textOccupation*/label?php echo $form- select('Vip.occupation_id', $this-requestAction('/occupations/ occSelect', array('cache' = '1 week', 'label' = false, 'div' = false))); ?/span Thanks for any thoughts, I'm thinking this may be a bug. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: error message on select box validation
Thank you David, I was hoping to avoid that and simply thought I was doing something wrong. Thanks! On Oct 19, 10:27 pm, David C. Zentgraf [EMAIL PROTECTED] wrote: If you use $form-input(), it will create everything for an input field, including label and error messages. If you use the more specialized select() you'll have to create labels and error messages yourself. See FormHelper::error(). http://api.cakephp.org/class_form_helper.html On 20 Oct 2008, at 07:49, clrockwell wrote: I'm using 1.2 and this is driving me crazy. I have a form with several fields that use validation. When I submit an empty form for testing all fields *except* the select have the appropriate html generated and the error message is displayed. The html for the select box begins with: label class=textOccupation*/labelselect name=data[Vip] [occupation_id] id=VipOccupationId On submitting without selecting anything, the html is this (class =form-error now present): label class=textOccupation*/labelselect name=data[Vip] [occupation_id] id=VipOccupationId class=form-error But there is no html generated below it. Dumping Model- invalidFields() shows: [occupation_id] = Please select the most appropriate occupation So it is definitely there. This happens on all select boxes. The code using to generate this one: label class=textOccupation*/label?php echo $form- select('Vip.occupation_id', $this-requestAction('/occupations/ occSelect', array('cache' = '1 week', 'label' = false, 'div' = false))); ?/span Thanks for any thoughts, I'm thinking this may be a bug. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: error message on select box validation
If you use $form-input(), it will create everything for an input field, including label and error messages. If you use the more specialized select() you'll have to create labels and error messages yourself. See FormHelper::error(). http://api.cakephp.org/class_form_helper.html On 20 Oct 2008, at 07:49, clrockwell wrote: I'm using 1.2 and this is driving me crazy. I have a form with several fields that use validation. When I submit an empty form for testing all fields *except* the select have the appropriate html generated and the error message is displayed. The html for the select box begins with: label class=textOccupation*/labelselect name=data[Vip] [occupation_id] id=VipOccupationId On submitting without selecting anything, the html is this (class =form-error now present): label class=textOccupation*/labelselect name=data[Vip] [occupation_id] id=VipOccupationId class=form-error But there is no html generated below it. Dumping Model- invalidFields() shows: [occupation_id] = Please select the most appropriate occupation So it is definitely there. This happens on all select boxes. The code using to generate this one: label class=textOccupation*/label?php echo $form- select('Vip.occupation_id', $this-requestAction('/occupations/ occSelect', array('cache' = '1 week', 'label' = false, 'div' = false))); ?/span Thanks for any thoughts, I'm thinking this may be a bug. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---