Friday, March 13, 2009

New: Client Side Javascript Validation plugin for Grails

So I created a grails plugin and i think it will be useful to everyone on a grails project.

So what does it do?

Well it is a client side javascript validator plugin that works with your existing constraints object. All you have to do is install it then put single tag on your page and you get instant javascript validation for your existing forms.

To install:

grails install-plugin javascript-validator


Next simply add this tag to your form page. This will show the errors as an alert box.

<jv:generate domain="book" form="bookForm" display="alert" />


Finally you then need to add an onsubmit event to your form. I may make this optional in the next release. But you need it for now.

<form action="/save" method="post" name="bookForm" id="bookForm" onsubmit="return validateForm(this);" >
...
</form>




If you want the error messages to show as list on the page do this:

<jv:generate domain="book" form="signUpForm" display="list" container="errors"/>



If you want validation on command objects then do this:


<jv:generate command="signUpCommand" controller="signUp" form="signUpForm" display="alert" />


<jv:generate command="signUpCommand" controller="signUp" form="signUpForm" display="list" container="errors"/>


That should get you going.

I need to write up the full documentation but will try to do that at the weekend. For now i am off to sleep.

Enjoy...

22 comments:

Website Design said...

I thought it was going to be some boring old post, but it really compensated for my time. I will post a link to this page on my blog. I am sure my visitors will find that very useful.

college board said...

Having read this post, I have learned for myself a lot of the new. Thanks

freelance academic writing said...

Thanks! This is a very good manual!

cheap research paper writing online said...

The best plugin for Javascript, I search it, thank you.

low t treatment said...

You certainly deserve a round of applause for your post and more specifically, your blog in general. Very high quality material

Søgemaskineoptimering said...

This is a good site to spent time on .I just stumbled upon your informative blog and wanted to say that I have really enjoyed reading your blog posts. I will be your frequent visitor, that’s for sure.

http://viagra118.com said...

This posting is marvelous and what a fantastic research that you have done. It has helped me a lot. thank you very much. Feel free to visit my buy portfolio lighting site.

http://cialis118.com said...

Happy to see your blog as it is just what I’ve looking for and excited to read all the posts. I am looking forward to another great article from you.

cialis online said...

This is a great inspiring article.I am pretty much pleased with your good work.You put really very helpful information. Keep it up. Keep blogging. Looking to reading your next post.

viagra online said...

I would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well. In fact your creative writing abilities has inspired me to start my own Blog Engine blog now. Really the blogging is spreading its wings rapidly. Your write up is a fine example of it…..

cialis-comprar.com said...

This is a good site to spent time on .I just stumbled upon your informative blog and wanted to say that I have really enjoyed reading your blog posts. I will be your frequent visitor, that’s for sure.

buy cialis said...

This is a good site to spent time on .I just stumbled upon your informative blog and wanted to say that I have really enjoyed reading your blog posts. I will be your frequent visitor, that’s for sure.

buy Articles writing and submission said...

Every one were at there best , great story and great performance by your team, keep up the good work , it is a great resources for the yal members for recurt no doubt.

youtube views and subscribers said...

This is a good site to spent time on .I just stumbled upon your informative blog and wanted to say that I have really enjoyed reading your blog posts. I will be your frequent visitor, that’s for sure.

link building said...

I've found this very interesting and has a good stuff for the readers and designers. I would be glad to recommend the post for its quality content. Nice post.

buy cheap facebook fans said...

I am very enjoyed for this side. Its a nice topic. It help me very much to solve some problems. Its opportunity are so fantastic and working style so speedy. I think it may be help all of you. Thanks,

azlaanaezi said...

Excellent post. I was checking constantly this blog and I am impressed! Extremely helpful info specially the last part :) I care for such information a lot. I was looking for this certain information for a long time. Thank you and best of luck.
buy youtube comments

Faisal Mehar said...

Awesome information you got here. I’ve been reading a lot about this and I am thankful for this article. It was indeed a great help. Thank you so much.
sell my htc

Anonymous said...

I agree with this article completely, I must thank you for posting such helpful facts.definition essay writing

Anonymous said...

Excellent post and wonderful blog, I really like this type of interesting articles keep it u. I am really loving the theme/design of your web site.logo design maestro

Anonymous said...

This blog is very useful information for me and guidance.dissertation service , thesis help uk , writing company , custom accounting uk , student essay , academic writing online

niki 3254 said...

The post is written in very a good manner and it entails many useful information for me. I am happy to find your distinguished way of writing the post. Now you make it easy for me to understand and implement the concept.school of business and manangement I really loved reading your blog. It was very well authored and easy to understand. Unlike additional I have read which are really not tht good. I also found your posts very interesting. In fact after reading, I had to go show it to my friend and he enjoyed it Airport Parking as well!Thanks so much for this! I have not been this thrilled by a blog post for quite some time! You’ve got it, whatever that means in blogging. Anyway, You’re definitely someone that has something to say that people should hear. Keep up the wonderful job. Keep on inspiring the people.meet and greet