On Sat, Sep 11, 2010 at 8:16 AM, Allan MacGregor <d...@allanmacgregor.com> 
wrote:
> Is there a way to specify the onClick event for radius tags? for
> example for a set checkboxes or a dropdown?

radius is just a template language for outputting other formats; (i
guess) most often html. so simply have radius output the html that
makes it easiest for you to script. for example:

<r:mailer:form name='x'>
 <div><r:checkbox value='a' name='a'/> <label for=a>A</label></div>
 <div><r:checkbox value='b' name='b'/> <label for=b>B</label></div>
 <div><r:checkbox value='c' name='c'/> <label for=c>C</label></div>
</r:mailer:form>

outputs:

<form action="/contact/check/" method="post"
enctype="multipart/form-data" id="mailer" name="mailer[x]">
  <div><input type="checkbox" value="a" id="a" name="mailer[a]">
<label for="a">A</label></div>
  <div><input type="checkbox" value="b" id="b" name="mailer[b]">
<label for="b">B</label></div>
  <div><input type="checkbox" value="c" id="c" name="mailer[c]">
<label for="c">C</label></div>
</form>

which you can script however you normally script html.

in plain old javascript style:

var target = function (e) {
 e = e || window.event;
 return e.target || e.srcElement;
};
document.forms['mailer'].onclick = function (e) {
 var t = target(e);
 if (t.type == 'checkbox') alert(t.value);
};

or in jquery style:

$('input[type=checkbox]').click(function () { alert(this.value) });

> On Sep 10, 5:55 pm, Wes Gamble <we...@att.net> wrote:
>>   You may want to check out jQuery, which allows you to do effects like
>> this.
>>
>> See:http://api.jquery.com/category/effects/for the jQuery API
>> documentation on the show() and hide() methods.
>> Download:http://docs.jquery.com/Downloading_jQuery
>> Tutorials:http://docs.jquery.com/Tutorials
>>
>> Given:
>>
>> <div class="x">
>>       This content will be shown/hidden.
>> </div>
>>
>> You would use something like
>>
>> $('.x').show() to show it and $('x').hide() to hide it.
>>
>> Good luck,
>> Wes
>>
>> On 9/10/10 3:32 PM, Horst Rischbode wrote:
>>
>>
>>
>> >  Hi,
>>
>> > I want to show (and be able to hide it again) a div on user's demand.
>> > I want to appear it similar to the 'less' & 'more' attributes
>> > behaviour of the edit page view.
>>
>> > I'm not familar with haml, so I don't understand, how to get this
>> > working on my gallery pages. Please be patient...
>>
>> > Can anybody point out, which JS libraries to include and how to build
>> > up a simple example with html?
>>
>> > Thanks for any advice!
>>
>> > Horst

Reply via email to