Disable submission

10 views
Skip to first unread message

Ofek Inbar

unread,
Jun 14, 2018, 10:50:07 AM6/14/18
to ActiveScaffold : Ruby on Rails Gem
Hi, I'm new to ActiveScaffold and Rails in general and I was navigating through the documentation but I couldn't seem to find a solution to my issue.
I want to disable submission of an edit/create form if certain fields don't meet certain conditions (simply disabling the "Update" button will do).
Can anybody help me find a solution?

Sergio Cambra

unread,
Jun 14, 2018, 5:39:42 PM6/14/18
to Ofek Inbar, ActiveScaffold : Ruby on Rails Gem
Hi Ofek

You have to bind change events with js on those fields and disable/enable submit button. Active scaffold adds a class with column name to each input ([column_name]-input) which you can use to bind events to. For example with jQuery:

$(document).on('change', '.column-input', function {
  if (...) {
    $(this).closest('form').find('.submit').prop('disabled', true);
  }
});

> --
> You received this message because you are subscribed to the Google Groups "ActiveScaffold : Ruby on Rails Gem" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to activescaffol...@googlegroups.com.
> To post to this group, send email to actives...@googlegroups.com.
> Visit this group at https://groups.google.com/group/activescaffold.
> For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages