I recently upgrade from forms v9.2 >> 10.1 and I'm getting some unexpected behavior on a form using a stored procedure that is called when the submit button is clicked. I'm using some of the logic found [Here] but it requires users to click the submit button twice. I'm no JS expert, so I'm not 100% sure what's going on. See code examples below:
Current Code - This submits and everything works correctly, other than having to click the submit button twice.
$('.action-btn').on('click', function(event)
{
if ($('.notused input').val() == "") //This is the stored proc trigger
{
$('#q3 input').attr('readonly', 'true');//this is the claim number field I'm looking to fill with the stored procedure
$('#q2 input').val("1").trigger('change');//This is the stored proc trigger
event.preventDefault();
waitfunction();
}
});
function fieldfilled()
{
return ($('#q3 input').val() != '');
}
function waitfunction()
{
setTimeout(function(){
if(fieldfilled())
console.log('nothing');
else
waitfunction();
}, 500);
}
Here is the code I was using before my upgrade that worked just fine! Now it does not save the Claim number to my repository:
$('.action-btn').on('click', function()
{
if ($('.notused input').val() == "") //stored proc trigger
{
$('#q3 input').attr('readonly', 'true');//claim number
$('.notused input').val("1").trigger('change');
}
});