How to trigger Save button on New form and open the Edit Form
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 2017
Dear bnunweiler,
Not sure why this happens, perhaps the Item is submitted twice, you can try to include a simple check to prevent it:
Not sure why this happens, perhaps the Item is submitted twice, you can try to include a simple check to prevent it:
Code: Select all
var saving = false;
fd.onsubmit(function() {
if (!saving){
saving = true;
//execute the rest of the code here
}
});
Cheers
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 2017
Dear bnunweiler,
Please, send us the code that you use on the New Form. We might've found the cause, but we'll need to see your code, so we can test it and make sure that it works as intended.
Please, send us the code that you use on the New Form. We might've found the cause, but we'll need to see your code, so we can test it and make sure that it works as intended.
Cheers
-
- Posts: 11
- Joined: Tue Jun 10, 2014
Here it is:
fd.field('Title').value('TEMP VALUE');
var saving = false;
fd.onsubmit(function() {
if (!saving){
var uri = fd.setUrlParam(decodeURIComponent(window.location.href), 'FDRedirectWithID', 'fd_Item_Edit.aspx?ID=');
fd.sourceFormParam(uri);
return true;
}});
fd.save().click();
fd.field('Title').value('TEMP VALUE');
var saving = false;
fd.onsubmit(function() {
if (!saving){
var uri = fd.setUrlParam(decodeURIComponent(window.location.href), 'FDRedirectWithID', 'fd_Item_Edit.aspx?ID=');
fd.sourceFormParam(uri);
return true;
}});
fd.save().click();
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 2017
Dear bnunweiler,
Please, use this instead, it should solve the issue:
Please, use this instead, it should solve the issue:
Code: Select all
var location = window.location.href;
if (location.indexOf('FDRedirectWithID') < 0){
fd.field('Title').value('TEMP VALUE');
fd.onsubmit(function() {
var uri = fd.setUrlParam(decodeURIComponent(window.location.href), 'FDRedirectWithID', 'fd_Item_Edit.aspx?ID=');
fd.sourceFormParam(uri);
return true;
});
fd.save().click();
}
Cheers
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 2017
Dear TKay,
Unfortunately, no, it's impossible to redirect users from dialog window. That's because when you close regular window, you can still run JavaScript while it closes and use it for redirection, but as soon as dialog window closes down, all scripts stop running and there is no way to redirect user after that.
Unfortunately, no, it's impossible to redirect users from dialog window. That's because when you close regular window, you can still run JavaScript while it closes and use it for redirection, but as soon as dialog window closes down, all scripts stop running and there is no way to redirect user after that.
Cheers
-
- Information
-
Who is online
Users browsing this forum: No registered users and 22 guests