Skip to content

Instantly share code, notes, and snippets.

@JDLeigh10
Created July 28, 2012 05:22
Show Gist options
  • Save JDLeigh10/3191909 to your computer and use it in GitHub Desktop.
Save JDLeigh10/3191909 to your computer and use it in GitHub Desktop.
jx
<script>
function validateForm() {
if((document.getElementById("creditScore_Excellent").checked == false) && (document.getElementById("creditScore_Good").checked == false) && (document.getElementById("creditScore_Poor").checked == false)) {
alert("Please enter a credit score");
return false;
} else {
return true;
}
}
</script>
<div id="header">
</div>
<div id="inputForm">
<%= form_tag('/parse', :onsubmit => "return validateForm()") %>
<%= label_tag :monthlySpending, 'Monthly Spending' %>
<%= number_field_tag('monthlySpending', value = 0, :in => 1...1000000) %><br />
<%= label_tag :categories, "General" %>
<input type="checkbox" name="categories[values][]" id="general" value="general" checked="checked" />
<%= label_tag :categories, "Gas" %>
<input type="checkbox" name="categories[values][]" id="gas" value="gas"/>
<%= label_tag :categories, "Movies" %>
<input type="checkbox" name="categories[values][]" id="movies" value="movies"/>
<%= label_tag :categories, "Museums" %>
<input type="checkbox" name="categories[values][]" id="museums" value="museums"/>
<%= label_tag :categories, "Restaurants" %>
<input type="checkbox" name="categories[values][]" id="restaurants" value="restaurants"/>
<%= label_tag :categories, "Groceries" %>
<input type="checkbox" name="categories[values][]" id="groceries" value="groceries"/>
<%= label_tag :categories, "Theme Parks" %>
<input type="checkbox" name="categories[values][]" id="theme_parks" value="theme parks"/><br />
<%= label_tag :creditScore, "Credit Score" %>
<%= label_tag :creditScore, 'Excellent' %>
<%= radio_button_tag('creditScore', 'Excellent') %>
<%= label_tag :creditScore, 'Good' %>
<%= radio_button_tag('creditScore', 'Good') %>
<%= label_tag :creditScore, 'Poor' %>
<%= radio_button_tag('creditScore', 'Poor') %><br />
<%= submit_tag(value="Submit") %>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment