How to stop UI Page Redirection after Clicking 'OK'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-15-2020 07:09 AM
Hi All,
I have a UI page for transferring a HRCase to IT Group and once I select the Assignment group and Click OK .
The issue I have is after clicking on OK , the page is getting redirected and not staying on the same form . Please let me know what changes need to be done for achieving this . Below is the UI Page Client Script part .
function yesnoCheck(val)
{
try
{
gel('selected_decision').value = val;
if(val == '1')
{
gel('worknotesection').style.display = 'block';
gel('commentssection').style.display = 'block';
}
else
{
gel('worknotesection').style.display = 'none';
gel('commentssection').style.display = 'none';
}
}
catch(e)
{
alert(e);
}
}
function valdiateGrpValue()
{
var finalresult;
var groupErrorBlock = $j('#groupError');
var groupValue = gel("assignment_group").value;
if(groupValue == '')
{
groupErrorBlock.html(getMessage('Please select a group'));
finalresult = false;
}
else
{
groupErrorBlock.html('');
finalresult = true;
}
return finalresult;
}
function valdiateDecisionValue()
{
try
{
var finalresult = false;
var decErrorBlock = $j('#decError');
var decisions = document.getElementsByName("decision");
var tlscore = '';
for (var i = 0, len=decisions.length; i< len; i++)
{
if (decisions[i].checked )
{
tlscore = decisions[i].value; // if so, hold its value in tlscore
finalresult = true;
break; // and break out of for loop
}
}
if(finalresult)
{
decErrorBlock.html('');
if(tlscore == '1')
{
var notesErrorBlock = $j('#noteError');
if(gel('worknotes').value == '' || gel('worknotes').value == ' ' || gel('worknotes').value == 'undefined')
{
notesErrorBlock.html(getMessage('Please fill Work Notes'));
finalresult=false;
}
else
{
notesErrorBlock.html('');
}
}
}
else
{
decErrorBlock.html(getMessage('Please select decision'));
}
return finalresult;
}
catch(e)
{
jslog(e);
}
}
function submitCancel()
{
GlideDialogWindow.get().destroy();
return false;
}
function submitOk() {
var result = $("assignment_group").value != undefined;
if(!valdiateGrpValue())
{
result=false;
}
if(!valdiateDecisionValue())
{
result=false;
}
if (result)
{
$('cancel_button').addClassName('disabled');
$('ok_button').addClassName('disabled');
}
return result;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-16-2020 04:54 AM
When you comment out the HTML section and try to save the changes, you should be getting an error since there is no </script> closing tag below </footer> at the bottom of the html script section. Add that line, comment the section you did before and see if that hides the second choice
The end of the processing script is redirecting to getUrlOnStack which is correct for a scoped app to return to it's original page. What happens before this window open - what screen are you on, and what do you do to make it open? What screen does it return to when you click OK? Maybe there's some code in the action that opens the window that is overriding the redirect.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-16-2020 05:18 AM
Hi,
so it should stay on same form;
can you try this in the processing script at the end
response.sendRedirect(task_table_name + ".do?sys_id=" + task_sys_id);
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-16-2020 05:47 AM
Hi
The issue about staying on the page is resolved now . But as I have mentioned in my previous reply above I an unable to hide the Radio button on the UI page .
could you please let me know how to hide the highlighted on UI page . I am pasting the HTML of the UI page
.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-16-2020 05:57 AM
Hi Ram,
So although you have commented the html code it is still showing up?
<!-- <label class="radio-inline" style='color:#303a46;'>
<input type="radio" id="decision2" name="decision" value="2" onchange="yesnoCheck(2);">Keep HR Case Open</input>
</label> -->
Any browser console error?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-16-2020 06:15 AM
Yes
Do I need to chaange anything else ? Please suggest.