18
With jQuery, you can bind a callback to the submit event with the .submit() method.
$("form").submit(function(){
// Let's find the input to check
var $input = $(this).find("input[name=whatever]");
if (!$input.val()) {
// Value is falsey (i.e. null), lets set a new one
$input.val("whatever you want");
}
});
Notice: To ensure that all the elements can be found it should be placed in a domready function.