willnet / ajax_error_renderer Goto Github PK
View Code? Open in Web Editor NEWa validation error renderer for ajax request
License: MIT License
a validation error renderer for ajax request
License: MIT License
render_ajax_error model: @user, location: '.error_messages'
if #error
doesn't exist and location
unspecified, error message displays inside form.
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。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.