You can put it anywhere.. in the index.html.erb or in layouts or in some
external javascript.. in third case make sure that you are calling that
javascript like <script src="/javascripts/yourjavascriptname.js">

On Wed, Sep 9, 2009 at 12:14 PM, HUNT HUNT <[email protected]
> wrote:

>
> Puneet Pandey wrote:
> > Rails obviously support client side validation. all you need is to put
> > onsubmit event on whatever the form syntax you are using. below is an
> > example:
> >
> > <% form_tag ({:action => "new"}, {:onsubmit => "return validate();"}) %>
> >
> > then your basic javascript goes like:
> --------------------------------------------------------------------------
> > function validate(){
> > if(document.getElementById('some_id')=="")
> >   alert("specify first name");
> > }
> >
>
>
> Thanks Puneet,
>
> WHere this validate function is embedded in index.html.erb?
> Any reference for the same is a great hint.
> -------------------------------------------------------------------------
> > On Wed, Sep 9, 2009 at 11:46 AM, HUNT HUNT
> > <[email protected]
> >> wrote:
> >
> >> Regards
> >> HUNT
> >> --
> >> Posted via http://www.ruby-forum.com/.
> >>
> >> >
> >>
> >
> >
> > --
> > Thanks and Regards
> >
> > ___________________
> >
> > Puneet Pandey
> > Ruby on Rails Developer
> > http://www.puneetitengineer.wordpress.com
> > In Puneet's Lab: http://www.puneetpandey.com
>
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>


-- 
Thanks and Regards

___________________

Puneet Pandey
Ruby on Rails Developer
http://www.puneetitengineer.wordpress.com
In Puneet's Lab: http://www.puneetpandey.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to