Coder Social home page Coder Social logo

ajax_error_renderer's People

Contributors

willnet avatar ykpythemind avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

ykpythemind

ajax_error_renderer's Issues

Change location of error messages

now

  • error messages display within #error by default.
  • If you want to display the messages in other place, you can do it by passing location option to render_ajax_error with css like following.
  • either one is necessary
render_ajax_error model: @user, location: '.error_messages'

after

if #error doesn't exist and location unspecified, error message displays inside form.

How to show errror next to fields?

Hello I'm newbie and really use Remote Form so easily like turbolinks.
I have 2 questions.

1.Is it possible to show the error next to fields in forms?
2.User controller like below is rails way? As far as I know, this is not scaffold one.

What I am thinking from here.
Well, I search many articles about Remote Form and I knew

The problem is that support for dealing with remote forms in Rails is incomplete:

in this article. Author,Jorge Manrubia, is in Bootcamp.

I don’t like this way because of add required at every fields.

If mix your gem which means easy implement and above article which means error next to fields in forms, I think it’s very ideal implement for Remote Form.
Hopefully we don’t change scaffold code like below....but this is not so important.

def create
   @user = User.new(user_params)

   respond_to do |format|
     if @user.save
       format.html { redirect_to @user, notice: 'User was successfully created.' }
       format.json { render :show, status: :created, location: @user }
     else
       format.html { render :new }
       format.json { render json: @user.errors, status: :unprocessable_entity }
     end
   end
 end

If someone do this, I think Rails realize good responsive UX and easy implement.
Unfortunately I have no skill...What do you think?

Maybe should I ask at rails issues??

DHHが書いたコメントにもありますが、バリデーションエラーになった際の対応は、SJR(Server-generated JavaScript Responses)などを利用して各自でエラーメッセージを表示する処理を書かなければなりません。このあたりもうちょっとうまくできるとturbolinksもう少し普及するんじゃないのかな、という気がします*2。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.