Form_tag vs form_remote_tag ----- the :condition option

form_remote_tag has a really useful little thingamob called
:condition. you give it a string which is then interpolated into the
form tag in such a way that the form is only submitted if :condition
evaluates in javascript to true.

so the logical thing to do is give it a JavaScript function

<%= form_remote_tag ( :condition => ‘your_function_here()’,
:url => {:action =>
‘your_action_here’} ) %>

as you can see, it is nifty.

but here’s the thing. form_tag doesn’t support this same useful
feature as far as I can tell.

am I wrong?

is there a simple way to implement this feature?

my JavaScript’s a bit rusty but I think you can probably just put it
in a function, and then reference the function from the form tag in
the HTML. if there’s anybody out there with fluent JavaScript – does
that sound right?

duh please ignore this question I forgot how easy this stuff was

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