You are viewing limited content. For full access, please sign in.

Question

Question

Trying to Trigger a Stored Procedure

asked on June 10, 2016 Show version history

Trying to generate a document number and display it back to the user. Want to do it on a checkbox trigger. It does use a table to do that. Right now, there are two possible numbering formats. This works great without the checkbox, but doesn't work once it's set up to trigger on the checkbox.

There are 4 lookups:

1 = Looks up info for Doc Class

2 = Looks up info for Doc Type based on Doc Class which provides the document numbering format desired

3 = Runs a stored procedure to look up the format of a document number, then pulls the next number.

4 = Displays the results of the next number into the Document Number field (see JavaScript).

$(document).ready(function () {
  $('#q102 input').change(function () {
    var check1 = $('#q102 input').prop('checked');
    if (check1 == true)
    {
     $('.triggerme input').val($('#q89 input').val());
    }
    else {
     $('.triggerme input').val("");
    }
  })
})
$('.triggerme input').trigger("change");

I know the change trigger probably doesn't belong there, but I've tried everything ... moving it up, calling it .change(), etc.

Works fine when triggered by Numbering Format. But I don't want to obtain the next number at that time, in case user changes their mind (don't want to waste a number). Would like it triggered by something like checking the "Reserve" box, which takes the Numbering Format value and puts into Doc_Number_Format_Execute_SP, then should run the Stored Procedure to get the next number, and is supposed to display the next number on the form. It doesn't even run the stored procedure.

Any ideas?

0 0

Answer

SELECTED ANSWER
replied on June 13, 2016

You can try move the line to trigger change up to just under the checkbox is checked.

$(document).ready(function () {
  $('#q102 input').change(function () {
    var check1 = $('#q102 input').prop('checked');
    if (check1 == true)
    {
     $('.triggerme input').val($('#q89 input').val());
     $('.triggerme input').trigger("change");
    }
    else {
     $('.triggerme input').val("");
    }
  })
});

 

0 0

Replies

replied on June 14, 2016

That worked! Thought I'd tried that, but I must not have because it worked fine this time! I knew it was just a matter of placement. Thank you!

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.