Question on observe_form

It seems like the observe magic is more about noticing changes to the
form,
as opposed to be able to discriminate what’s being done.
To clarify what I’m saying since I’m tired and probably not making any
sense

The form knows when a user makes a selection, but when the user
de-selects
it detects a change and sends things through However what it can’t do
is
detect that nothing should be sent, meaning blank values.
Hope I’m making some sense here. Perhaps there is a better way to
control
it?

Stuart


Well, that kind of logic doesn’t really belong in the view, anyway, it
really should be in the controller. So - your observe_form sends all
‘changes’ to your controller, and in your controller you can evaluate
what has been sent and whether or not anything should be done in the
view, and act accordingly. Since it’s all happening in the ‘background’
anyway, i.e., as a remote AJAX call, if your controller decides that
nothing should be done, your users aren’t going to notice.

c.

Stuart Fellowes wrote:

It seems like the observe magic is more about noticing changes to the
form,
as opposed to be able to discriminate what’s being done.
To clarify what I’m saying since I’m tired and probably not making any
sense

The form knows when a user makes a selection, but when the user
de-selects
it detects a change and sends things through However what it can’t do
is
detect that nothing should be sent, meaning blank values.
Hope I’m making some sense here. Perhaps there is a better way to
control
it?

Stuart

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs