additional hidden input field to surpass this
"specification/limitation"; so when there's no value selected in the
dropdown, the hidden field's empty value was sent, and when a value
was selected, it oversteered the hidden field's empty value. I guess
this looked something like that:
<input type="hidden" name="data[Comment][post_id]" value="" />
<select name="data[Comment][post_id]">
<option value="1">...</option>
</select>
Does this violate any HTML spec?
Let's say that comments really can exist without being related to a
post: so what if I want change a comment's post_id to "no post", i.e.
null? This wouldn't be possible without the workaround above, would
it? Or I would have to specify a "null" value that's checked for in
the controller and then manually set the post_id to null?
On Fri, Dec 31, 2010 at 12:18 AM, cricket <zijn.digital@gmail.com> wrote:
> On Thu, Dec 30, 2010 at 4:12 PM, psybear83 <psybear83@gmail.com> wrote:
>> Hey everybody
>>
>> I just noticed that when I'm having an empty dropdown list and send
>> it, then its key in the data (e.g. data[Comment][post_id]) goes
>> missing, and I get a blank screen (probably because the Security
>> component thinks the form was manually changed).
>>
>> Is this normal?
>
> It's part of the HTML spec. The browser won't send data for an element
> that effectively has no data to send.
>
>> Is there a fix for this?
>
> Don't include an empty select list in the form. Or include
> 'Comment.post_id' in Security's $disabledFields array.
>
> ... But why would you ever have a Comment with no Post?
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
>
> 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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
>
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
No comments:
Post a Comment