Jump to content

Javascript in Bulk Edit to send to new destination after submit


Recommended Posts

Hi, I'm trying to use some 'After Submit' code in a tabular datapage's Bulk Edit footer to go to a new destination after submission. The code below runs an 'auto submit' in Bulk Edit as well, but I can't get it to go to a new page afterwards. Does anyone know how to format this code so that after Bulk Edit submits a new page is navigated to? 

<script>

var bulkEditSubmit = document.querySelector('.SimpleButton.ActionButton[value=Update]');
console.log(bulkEditSubmit);

document.addEventListener('FormSubmitted', function(event) {
 window.location = '../invoice?InvoiceID=[@field:InvoiceID]&ProjectID=[@field:ProjectID]&pti=i';
});

setTimeout( () => { bulkEditSubmit.click(); }, 1000);

</script>

 

Link to comment
Share on other sites

Solved: in case anyone needs help with this:

Put this code in the footer of the Bulk Edit form (it also references a couple fields in the form for parameter values). Here's a previous post about this: 

 

<script type="text/javascript">

var v_invoice = document.getElementById("BulkEditInvoiceID").value;

var v_project = document.getElementById("BulkEditProjectID").value;

var v_url = "../invoice?InvoiceID=" + v_invoice + "&ProjectID=" + v_project;

var updateBtn = document.querySelector('.ButtonsCtnr > .ActionButton');

updateBtn.onmouseup = redirectToDP;

function redirectToDP() {

var url = v_url;

location.replace(url);

}

</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...
 Share

×
×
  • Create New...