UI Page: Cancel Button Not Working

Nya Valdez
Kilo Guru

Hello Community,

I'm having an issue with my cancel button not working on a UI page I've built. When I click on the button, it copies any field values I've inserted into the record. If anyone can please take a look at it and let me know what I've missed, I'd greatly appreciate it. It should be fairly simple ... Here is my code:

 

HTML Script: 

 

<button class="btn btn-default" onclick="closeWindow()" style="margin-right:10px;">Cancel</button>

 

Client Script:

 

 

function closeWindow(){
		GlideDialogWindow.get.destroy();
		var urlOnStack = GlideSession.get().getStack().bottom();
response.sendRedirect(urlOnStack);
}

 

14 REPLIES 14

@Nya Valdez bit confused can you please elaborate more ? i think we are almost there with the solution 

 

Hi @Mohith Devatte 

Yes, to explain a bit more - this UI page is actually used in conjunction to a UI Action that is visible as a list UI action on the Release task table (list view).  The goal is to update multiple records using that UI Action ("Validation Sign Off").  The UI page opens to show the two fields that match the actual Release Task form and allows the user to update both fields for all selected records in the list view. If a user chooses to update the work notes field, but not check the checkbox which may already be selected - we don't want the checkbox to be deselected.  We wish for nothing to be updated on the forms at all when they click cancel.  I hope this helps and I really appreciate your guidance on this so far!!

Hi @Mohith Devatte I am still in need of help to make this work. The cancel button should close the UI page without making any updates to the form itself.  So far, if I click cancel then it blanks out the fields that I have not updated rather than leaving them alone.  Do you have any ideas around d how I can get this to work correctly? Please advise. 

Hello @mdash 

Do you have any suggestions around how I might be able to resolve this issue? Please advise. 

ChrisBurks
Mega Sage

I just wanted to bring up one note as you're probably not seeing an error because the window is being destroyed but GlideSession is a server side method.

You'll want to move that into the Server Script part of the UI Page.
However, using the redirect is going to refresh or take you away from the page. If in your last example you need to keep some info you'll either need to pass that back to the page via url parameters or don't redirect until you truly want to close out the page.