ok thx

On Wed, Jun 30, 2010 at 8:59 PM, Me <chabg...@gmail.com> wrote:

> You need to add condition, where if a box is checked show div.
>
> On Jun 30, 7:11 pm, tom <tomabr...@gmail.com> wrote:
> > hi,
> > im gettin lost with the subject. need some pointers:
> >
> > Usermodel:
> >   validates_presence_of     :companyname,      :if => :is_company?
> >
> > <p><%= f.label "Are u representing a company?" %>
> > <%= f.check_box :is_company, :onclick => "new
> Effect.toggle('div_company');
> > //if($('user_is_company').value == 0){$('user_is_company').value =1;}
> > //if($('user_is_company').value == 1){$('user_is_company').value =0;}
> > //alert(escape($('user_is_company').value))"  %>
> >
> > <div id="div_company" style="display:none;" >
> > <fieldset style="width: 70%">
> > <legend> Details </legend>
> >
> > <p><%= f.label "Company Name" %><br />
> > <%= f.text_field :companytitle %></p>
> > ......
> >
> > my problem is:
> > if someone is signing up AND checking the box "is_company" the company
> > detail div appears. now, if the company details dont pass the validation,
> > the page gets naturally reloaded and the checkbox is_company stays
> checked
> > but the div is hidden.
> >
> > tried several ways , but all end up in chaos....
> >
> > does anyone have any working snippets?/thx
>
> --
> 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-t...@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com<rubyonrails-talk%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

-- 
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-t...@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