Wap Addon wrote:
> Matt Jones wrote:
>> Don't think like this - as other posters have pointed out, you're
>> going to have to do server-side validation anyways. Worrying about the
>> execution time of something this small is exceptionally premature
>> optimization.
>> 
>> In your example, the JS validation may work, but you're still going to
>> have to validate server-side, as some users may have JS turned off.
>> 
>> --Matt Jones
>> 
>> On Aug 22, 5:43�am, Wap Addon <[email protected]>
> 
> ok dear that's true

Use Live Validation.

<%= f.submit 'Create', :onClick => 'new_animal()' %>


function new_animal(){
alert('animal');
  if(document.getElementById('animal_name').value=="")
      {
          alert("Enter name...");
          document.getElementById('animal_name').focus();
          return false;
      }
  if(document.getElementById('animal_desc').value=="")
      {
          alert("Enter animal description ...");
          document.getElementById('animal_desc').focus();
          return false;
      }
return true;
}


hope it will run.......
-- 
Posted via http://www.ruby-forum.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