Skip to content

xitarps/simple_ajax_form

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SimpleAjaxForm

This gem was made in order to "bring back" the form_with remote: true(ajax) feature to rails 7;

Since it became a bit hard to use ajax with rails 7, this gem's intention is to make it "easy to use" the feature again

Installation

Install the gem and add to the application's Gemfile by executing:

$ bundle add simple_ajax_form

If bundler is not being used to manage dependencies, install the gem by executing:

$ gem install simple_ajax_form

If you prefer to put by yourself on Gemfile and run command bundle install:

  gem 'simple_ajax_form', '~> 0.1.26'

Usage

Inside of your .erb file:

1 - Add ajaxForm to your form_with class

2 - Insert the request helper right after the form_with tag:

<%= form_with ... ,class: 'ajaxForm' do |f| >
<% end >

<%= SimpleAjaxForm::RequestHelper.enable_class_use_on_forms_html %>

Under the hood

This gem uses vanilla javascript with fetch to perform the request

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/xitarps/simple_ajax_form.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published