input[type=checkbox] and Form.Element#getValue
-
MadRabbit
I thought about it designing the method and here is the thing.
There might be several checkboxes and everyone of them will have different value. So we need that method, to return correct value of the checkbox, whether it checked or not, coz there are cases when you need the actual value regardless it's state.
But your case have makes sense as well, and here is how you can deal with that. There is a form method called
#valuesthat returns a hash of the form values. That method filters out all the disabled and unchecked radio/checkbox inputs. So if you need the actual value that the form will send, you can do that kinda like thatvar value = $('my-input').form.values()['the_name'];if it's too long and ugly you always can define your own method for your application
-
Douwe M.
Yeah, I'm using something like that already, I just thought, maybe it would be a good idea to make the
getValue()method act like this, but I see why that's not ideal either.
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.