Add validation
This commit is contained in:
parent
5f3a2578c4
commit
7810faaa63
|
@ -3,8 +3,9 @@
|
||||||
<head>
|
<head>
|
||||||
<title>Adopt a Hydrant</title>
|
<title>Adopt a Hydrant</title>
|
||||||
<%= stylesheet_link_tag "main" %>
|
<%= stylesheet_link_tag "main" %>
|
||||||
<%= javascript_include_tag "https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" %>
|
|
||||||
<%= javascript_include_tag "http://maps.google.com/maps/api/js?sensor=false" %>
|
<%= javascript_include_tag "http://maps.google.com/maps/api/js?sensor=false" %>
|
||||||
|
<%= javascript_include_tag "https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" %>
|
||||||
|
<%= javascript_include_tag "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.10/jquery-ui.min.js" %>
|
||||||
<%= javascript_include_tag "https://github.com/scottschiller/Snowstorm/raw/master/snowstorm-min.js" %>
|
<%= javascript_include_tag "https://github.com/scottschiller/Snowstorm/raw/master/snowstorm-min.js" %>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function() {
|
$(function() {
|
||||||
|
@ -62,6 +63,16 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
addMarker(point, color, contentString);
|
addMarker(point, color, contentString);
|
||||||
<% end %>
|
<% end %>
|
||||||
|
$('#location_form').submit(function() {
|
||||||
|
if($("#address").val() === "") {
|
||||||
|
$('#address_label').addClass('error', 500);
|
||||||
|
$('#address').addClass('error', 500);
|
||||||
|
$('#address').focus();
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
$('.box input[type="radio"]').live('click', function() {
|
$('.box input[type="radio"]').live('click', function() {
|
||||||
var self = $(this);
|
var self = $(this);
|
||||||
if('new' == self.val()) {
|
if('new' == self.val()) {
|
||||||
|
|
|
@ -3,10 +3,10 @@
|
||||||
<p id="tagline">
|
<p id="tagline">
|
||||||
Claim responsibility for shoveling out a fire hydrant after it snows.
|
Claim responsibility for shoveling out a fire hydrant after it snows.
|
||||||
</p>
|
</p>
|
||||||
<%= form_tag "/", :method => :get, :class => "location_form" do %>
|
<%= form_tag "/", :method => "GET", :id => "location_form" do %>
|
||||||
<%= label_tag "city_state", "City" %>
|
<%= label_tag "city_state", "City", :id => "city_label" %>
|
||||||
<%= select_tag "city_state", '<option value="Boston, MA" selected="selected">Boston, MA</option>'.html_safe, :tabindex => 10 %>
|
<%= select_tag "city_state", '<option value="Boston, MA" selected="selected">Boston, MA</option>'.html_safe, :tabindex => 10 %>
|
||||||
<%= label_tag "address" %>
|
<%= label_tag "address", "Address", :id => "address_label" %>
|
||||||
<%= text_field_tag "address", params[:address], :tabindex => 11 %>
|
<%= text_field_tag "address", params[:address], :tabindex => 11 %>
|
||||||
<%= submit_tag "Find Fire Hydrants", :tabindex => 12 %>
|
<%= submit_tag "Find Fire Hydrants", :tabindex => 12 %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
Loading…
Reference in New Issue