Skip to content

Instantly share code, notes, and snippets.

@bennick
Last active December 11, 2015 02:29
Show Gist options
  • Save bennick/4531291 to your computer and use it in GitHub Desktop.
Save bennick/4531291 to your computer and use it in GitHub Desktop.
create action button listner
/*****************************/
/* Action for Create button */
/*****************************/
$("form#search_form").submit( function(event) {
event.preventDefault();
// get word from input form
word = $(this).children("input:text").val().toUpperCase();
word_len = word.length;
// Fill out group products drop down
$('#product_id')[0].selectedIndex = word_len - 1;
// Put word as input value to pass to the server
$("#name_input").val(word);
// Submit the form
$('#product_id').trigger("change");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment