Jump to content

How to put jQuery code in the Destination of an Update/Submission form?


Recommended Posts

Hello,

I can't figure out the right syntax for this jquery code to run automatically after submission/update.

It runs now (in the datapage footer) when the Submit button is clicked (it opens a FancyBox) but I need it to run after submission by a slight delay.  The reason is that on Submit table  A runs a trigger that updates table B and the FancyBox (opens another datapage in an iFrame) uses table B.

Sometimes the FancyBox opens too fast, before the trigger has updated table B, and so it doesn't show the latest value.

I figure if the code that opens the fancybox runs in the Destination after submission it would be enough of a delay for the trigger to run behind the scenes. I just don't know how to change the code so that it runs automatically in the Destination (message) after submission. 

Here's the current code, it's activated by a submit button with an id="openfb". I need it to run automatically in the Destination, after submission- any help would be great!

<script type="text/javascript">

$("#openfb").on('click', function() {

var width = 1100;
var v_href= "http://127.0.0.1:9090/shortcuts/universal-item-search2?";

parent.$.fancybox.open({
closeBtn:false,
openEffect : 'none',
closeEffect : 'none',
modal:true,
type:'iframe',
autoSize:true,
width:width,
href:v_href

});

});

</script>

 

Link to comment
Share on other sites

Just figured this out, if anyone needs it. Was simpler than I thought, just remove the button's onclick fucntion lines: 

<script type="text/javascript">

var width = 1100;
var v_href= "http://127.0.0.1:9090/shortcuts/universal-item-search2?";

parent.$.fancybox.open({
closeBtn:false,
openEffect : 'none',
closeEffect : 'none',
modal:true,
type:'iframe',
autoSize:true,
width:width,
href:v_href

});

</script>

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...