Skip to content

Instantly share code, notes, and snippets.

Created March 5, 2009 00:05
Show Gist options
  • Save anonymous/74101 to your computer and use it in GitHub Desktop.
Save anonymous/74101 to your computer and use it in GitHub Desktop.
<div class="formContainer">
<script type="text/javascript">
function activateConditionals() {
var from_load = arguments ? arguments[0] : false;
$('body').getElementsBySelector('conditional').each(function(e) {
eval(e.readAttribute('condition_change'));
});
}
</script>
<% form_for :answers do |answer| %>
<h1>Gift Aid questions</h1>
<div class="formContainer">
<table border="0" cellspacing="1" cellpadding="1">
<tr id="taxpayer" class="conditional">
<td halign="left">Are you a UK Taxpayer?</td>
<div>
<td halign="right" nowrap>Yes <%= answer.radio_button(:uk_taxpayer, true, :onclick => "activateConditionals();") %> </td>
<td halign="right" nowrap> No <%= answer.radio_button(:uk_taxpayer, false, :onclick => "activateConditionals();") %> </td>
<td></td>
</div>
</tr>
<tr id='relativequestion' class="conditional" condition_change="
alert ('jfheailwfneofniwoqn;aiju ');
askrelative = $('taxpayer');
self = $('relativequestion');
if askrelative.options[askrelative.answers[uk_taxpayer]].value == true {
self.show();
} else {
self.hide();
}
">
<div>
<td halign="left"> Are you a relative of the fundraiser? &nbsp;</td>
<td halign="right" nowrap>Yes <%= answer.radio_button(:relative, true) %></td>
<td halign="right" nowrap><label> No <%= answer.radio_button(:relative, false) %></label></td>
<td></td>
</div>
</tr>
<tr class="no">
<td> What is the source of the money for this donation? &nbsp;</td>
<td></td>
<td valign="right"> <%= answer.select(:money_source, { 'Self' => 'self', 'Other People' => 'other', 'Company Donation' => 'company'}) %></td>
</tr>
<tr>
<td>Are you donating in return for a benefit such as a ticket to an event, in a raffle, or as part of an auction?</td>
<td>Yes<%= answer.radio_button(:donor_benefit, true)%></td>
<td>No<%= answer.radio_button(:donor_benefit, true)%></td>
</tr>
<tr><div class="seperator"></div></tr>
</table>
<%= submit_tag "Next" %>
<% end %>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment