# Can any one give me answer about remote\_form\_for..?

**URL:** <https://www.ruby-forum.com/t/can-any-one-give-me-answer-about-remote-form-for/157875>\
**Category:** Rails\
**Created:** [January 16, 2009, 6:25am UTC](https://www.ruby-forum.com/t/can-any-one-give-me-answer-about-remote-form-for/157875 "2009-01-16T06:25:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![vikas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/ac91a4/32.png) [@vikas](https://www.ruby-forum.com/u/vikas)\
**Post date:** [January 16, 2009, 6:25am UTC](https://www.ruby-forum.com/t/can-any-one-give-me-answer-about-remote-form-for/157875/1 "2009-01-16T06:25:03Z")

</div>

Can any one give me answer???

I want to check whether textfield is empty or not at onsubmit event of  
form, but it is not working.  
Can any one tell me how to check empty textfield on remote\_form\_for’s  
onsubmit event???

my code is ---------------\>

\<%remote\_form\_for(:comments, @comment, :url =\> @commentUrl, :html =\>  
{:method =\> :post, :onsubmit =\> ‘if ($(“comments\_comment”).value == “”)  
{showNotificationMessage(“Please enter comment”, Notification.Error,  
comments\_comment); return false;}’}) do |f| %\>  
\<%= f.text\_area “comment”, :rows =\> 2,  
:style=\>“width:100%;padding-right:8px;margin-top:8px;margin-bottom:8px;”  
%\>

```
  <%=submit_to_remote f, "Add comment",
    :url => @commentUrl,
    :update => { :success => divID, :failure => divID }%>
<%end%>

```

‘onsubmit’ is not excuted during form submit.  
Any one can help me.
