Hi Walter,

Can you please elaborate on how exactly I would be able to use 
Event.preventDefault() with a conditional..?. Also why would I need to 
use a conditional..? I ask this as I am a newbie to Jquery and my 
javascript fundas are not very good.

To make it easier for you to answer this for me.. I have included the 
part of the code in the partial where you say it would be appropriate to 
put the button..

<%if @current_user.is_an_existing_member_of_group(@investor_group)%>
<%form_for :group_post, @group_post, :url => {:action => :post_message, 
:id => params[:id]},:html => {:multipart => true}  do |f| %>
    Start Discussion:<%=f.text_field :message%>
   <%=  f.file_field :avatar %>
   <%=f.submit "Post" %>
  <%end%>

<div id = "latest_post"> </div>
<%for a in @group_all_posts %>
  <%if !a.avatar_file_name.to_s.empty? %>
  <br/> <%= image_tag a.avatar.url(:thumb) %>
  <%end%>
<br/><%= a.message %> <br/> by <%=  Investor.find(a.post_by).first_name 
%> <div class ="contentdispgrp" id="style_chck"> <%= 
distance_of_time_in_words(a.created_at,Time.now) %> ago </div><br/><br/> 
<hr/>
<%end%>


I would truly appreciate you extra effort in trying to help me..

Kindly bear with my being a novice.

Many Thanks for your inputs..

Walter Davis wrote in post #1000079:
> On May 21, 2011, at 9:27 AM, Mohnish J. wrote:
>
>> How can i display the same onclick of a button without
>> making/getting the entire page to reload..
>
> With Event.preventDefault(). If in Prototype, with Event.stop(). Be
> sure to wrap this method in a conditional, otherwise you have just
> killed the button and it will never bubble to submit the form again.
>
> Walter

-- 
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to