<g:ui_form> processing scripts

Stewe Lundin
Mega Guru

Hi!

Setup:
I have a UI Action from the Incident form, a button.

The button opens a dialog that loads data from the Time Card table, showing reported time on the incident connected to the employee. 

The dialog has a number of fields that the user can change and some of the are pre populated with data from the incident and also data retrieved from other tables.

The issue:
When saving the form to the Time card table, pressing the submit button in the form, the page reloads, and instead of closing the dialog and returning to the incident form, the dialog "takes over" and the incdent form is "lost". 

find_real_file.png

On pressing submit 
find_real_file.png

I have tried to trigger the processing script in a few ways and then only way I can get it to work is with a simple Submit Button 

<div class="right"><button>Submit</button></div>

 This will not even trigger the Processing script.

 <g:dialog_buttons_ok_cancel ok="return validateDialog()" ok_type="button" cancel_type="button" />

the validateDialog() in client script , closes the dialog and returns true, and then nothing happens

function validateDialog() {
	
	GlideDialogWindow.get().destroy(); //Close the dialog window
	
	return true;
}




What I want to achieve, is to close the dialog, save the data and return to the incident form. 
I can close the dialog box,via client script, but I cant trigger the  processing scrip or I can trigger the process script but not close the dialog and return to the incident form. 

 

 

1 ACCEPTED SOLUTION

Stewe Lundin
Mega Guru

This fixed it. 

Added to the Processing script;

var urlOnStack = GlideSession.get().getStack().bottom();
	response.sendRedirect(urlOnStack);

 

View solution in original post

9 REPLIES 9

Dante Ditan
Kilo Sage

Hello,

 

Have you added the <g:ui_form> in your html field?

You need to add name attribute in any field you are fetching in processing script.

It will be easy for us to check if you provide screenshots of your UI page.

 

Thank you

Dante

Stewe Lundin
Mega Guru

Hi Dante!

Yes I have named all the inputs and attributs that I expect to retrieve from the form and that works, the processing script works and the data is saved in the table. 

But I cant get it to be destroyed, but instead it reloads it self as the main window. As shown in screen shots above. 

Yes I have the <g:ui_form> tag (see pic) 

 

find_real_file.png

find_real_file.png

find_real_file.png

find_real_file.png

 

Can I have your client script? Did you put return false; on it?

Stewe Lundin
Mega Guru

I don't have a client script at the moment...


But I had a client script that returned true;

My button goes direkt to the Processing Script. 

In the original post you have the clinet script that I used, that closed the dialog but failed to save...
function validateDialog()

{

GlideDialogWindow.get().destroy(); //Close the dialog window

return true;

}