Forum: Ruby on Rails Help on implementing rails from html with php

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Bao L. (Guest)
on 2006-01-26 05:41
Hi guys, just started using rails and is trying to implementing the
present html with some rails...

However i met this problem when i am trying to port over some php code
in html to rails and i cant find any method to successful convert the
php codes.

Below is a feature i tried to implement in rails way:

there are 2 buttons on the html. Besides these 2 buttons is an infobox.
So, whenever one of the buttons is pressed, the infobox have to show the
respective information assigned to each button. At any one time, only
one button can be pressed and the infobox have to change the information
displayed inside it accordingly and immediately.

Here is the code i did and not sure wat's wrong:
<fieldset>
<legend>button info</legend>
<div id="InfoBox">
<h2>Info</h2>
  <div id="button1">
  <strong>Button1</strong>
  some text here
  </div>
  <div id="button2">
  <strong>Button2</strong>
  some text here
  </div>
</div>
<label for="buttons">2 buttons</label>
<input type="radio" id="button1"
onclick="Effect.Appear('button1')">Button 1
<input type="radio" id="button2"
onclick="Effect.Appear('button2')">Button 2
</fieldset>

Thanks for any help anyone can provide me.
Bao L. (Guest)
on 2006-01-26 11:14
bao lee wrote:
> Hi guys, just started using rails and is trying to implementing the
> present html with some rails...



Anyone can help????
Alex Y. (Guest)
on 2006-01-26 14:04
(Received via mailing list)
bao lee wrote:
> Hi guys, just started using rails and is trying to implementing the
> present html with some rails...
<snip>

Firstly, you've given the buttons the same IDs as the divs they're
referring to.  That can't work.  Secondly, you've not taken care of
making anything disappear.  Thirdly, Effect.Appear() et al need to be
called as constructors.  Finally, although it's understandable that you
aren't aware of it, the correct list for this question would be
removed_email_address@domain.invalid, because it's a scriptaculous
problem rather than about Rails itself.

Oh, the code?  Try this:  :-)

  <fieldset>
  <legend>button info</legend>
  <h2>Info</h2>
  <div id="InfoBox" style='position: relative; height: 3em'>
    <div id="button1" style='display: none;position: absolute;top:0px'>
    <strong>Button1</strong>
    some text here
    </div>
    <div id="button2" style='position:absolute;top:0px;'>
    <strong>Button2</strong>
    some text here
    </div>
  </div>
  <label for="buttons">2 buttons</label>
  <input type="radio" name='foo'
  onclick="new Effect.Appear('button1');new
Effect.Fade('button2');">Button 1
  <input type="radio" name='foo'
  onclick="new Effect.Fade('button1');new
Effect.Appear('button2');">Button 2
  </fieldset>

Tested to be fine in Firefox, although I've jiggled your tree a bit, so
to speak.
Bao L. (Guest)
on 2006-01-27 03:39
Alex Y. wrote:
> bao lee wrote:
>> Hi guys, just started using rails and is trying to implementing the
>> present html with some rails...
> <snip>
>
> Firstly, you've given the buttons the same IDs as the divs they're
> referring to.  That can't work.  Secondly, you've not taken care of
> making anything disappear.  Thirdly, Effect.Appear() et al need to be
> called as constructors.  Finally, although it's understandable that you
> aren't aware of it, the correct list for this question would be
> removed_email_address@domain.invalid, because it's a scriptaculous
> problem rather than about Rails itself.
>
Oh sorry about that... didnt know that the nature of the problem is not
rails itself... thanks for all your trouble.
This topic is locked and can not be replied to.