Skip to content

Instantly share code, notes, and snippets.

@rustyrazorblade
Created December 15, 2011 20:55
Show Gist options
  • Save rustyrazorblade/1482835 to your computer and use it in GitHub Desktop.
Save rustyrazorblade/1482835 to your computer and use it in GitHub Desktop.
broken
function submit_new_bill()
{
// check amount
error = false
amount = $('#amount').val()
errors = []
people = $('#bill_to').val()
if( amount <= 0 )
{
$('#amount').addClass('ui-state-highlight')
$('#add_bill_error').html('Please enter the amount of the tab greater than 0.').addClass('ui-state-error')
return false
}
if( people == "" )
{
$('#bill_to_link').addClass('ui-state-highlight')
$('#add_bill_error').html("Please pick how you'd like to split the bill, and with whom.").addClass('ui-state-error')
return false;
}
else if( $('#submit_comment').val() == "" )
{
$('#bill_to_link').addClass('ui-state-highlight')
$('#add_bill_error').html("Please add a description.").addClass('ui-state-error')
return false
}
$.post('/api/submit', $('#add_bill_form').serialize(),
function(result) {
submit_type = $('input[name=entry_type]:checked', '#add_bill_form').val()
track('goal', 'submit')
show_status()
} );
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment