AnsweredAssumed Answered

Saving with JavaScript

Question asked by papancsev on Dec 1, 2017
Latest reply on Dec 7, 2017 by papancsev

Hi!

I try to save a form and redirect it to another page.

The save button is hidden with css ( .saveButton {visibility: hidden;}) and I use a javascript button to fire the function.

The redirection is working, but the list item isnt saved.

(I dont use the built in redirect as I would like to extend the function with else if logic and different links)

 

This is the code:

function saveAndRedirect() {
  NWF$('.saveButton').click();
  window.location.replace('https://www.google.com');
}

 

I added a "test" code to the hidden save button client click if it is clicked or not by the function and it is clicked as the alert is popping up correctly!

Client click: NWF$(document).ready(function(){alert('Save Clicked');});

 

My conclusion is that the code is good so far as the function is clicking the save button and the page is redirected, BUT why it is not saved to the list? Is there an additional code to actually save the item?

Outcomes