Hello All,
I have a form with a text-area and a submit button.The user can write
one''s status in the text-area and click on submit button.After
clicking on the submit button,I want the status to be displayed
immediately on the page.What is the best way to do this in Rails?Does
the label tag solve my problem here? or should I use a span tag?
The piece of code is as follows
***********************************************************************************************************************************
<div id="msg_div" style="padding-left:20px;padding-top:
1px;height: 38%;">
<div id="about_me_text"
style="float:left;border-
style: solid;border-color:red;width: 47%;">
<%
form_for :about_me ,
:url=>{:controller=>''home'',:action=>''update_about_me''},
:html=>{:name=>''frmpostchannellist'',:style
=> ''margin:0px;''} do %>
<div class="mainInput"
style="padding-left:20px;">
<span>Please write a few comments about
yourself </span>
<div style="width:100%;">
<div style="width:auto;float:left;">
<textarea rows="4"
cols="50" id"message"
style="overflow:auto;width:96%;" name="message" maxlength
="<%= APP_CONSTANTS[''post_msg_length'']%>"
onkeyup="checkPostFieldLength(message,''remaining'',
<%APP_CONSTANTS[''post_msg_length'']%>);"
onkeydown="checkPostFieldLength(message,''remaining'',
<%APP_CONSTANTS[''post_msg_length'']%>);"
onmouseout="checkPostFieldLength(message,''remaining'',
<%APP_CONSTANTS[''post_msg_length'']%>);"></textarea>
<br/>
<br/>
<span id="remaining"
class="count"><%APP_CONSTANTS[''post_msg_length'']%></span>
characters remaining
<br/>
<br/>
<script type="text/javascript">
var message = new
LiveValidation("message", {
validMessage: "",
wait: 500,
onlyOnSubmit: true
});
message.add(Validate.Presence, {
failureMessage: "<
%=t :error_messages_message_presence %>"
});
message.add(Validate.Length, {
maximum:
<%APP_CONSTANTS[''post_msg_length'']%>,
failureMessage: "<
%=t :error_messages_message_length %>"
});
</script>
<%= submit_to_remote
"create_btn","
",
:update => "display_my_status",
:loading =>
"Element.setOpacity(''widget'',''0.4'');Element.show(''spinner_page'');",
:loaded =>
"Element.setOpacity(''widget'',''1'');Element.hide(''spinner_page'');document.frmpostchannellist.message.value
=
'''';document.getElementById(''remaining'').innerHTML
= 400;",
:url => {:controller=>"home",
:action
=> "update_about_me"},
:html => {:class => "searchButton
feedBackSubmitBtn", :id => "submitButton" } %>
</div>
</div>
</div>
<% end %>
</div>
<div id="about_me_display"
style="float:right;border-style: solid;border-color:brown;width:
50%;">
<span id ="display_my_status"
style="height:auto;">
<%=h @my_status%>
</span>
</div>
</div>
***********************************************************************************************************************************
Also I want to know what id do I give in the update statement in the
submit_to_remote tag?
Thanks in advance
Regards
Chandrika
--
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.