Not render Content In GlideDialogWindow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-08-2024 12:00 PM
Clinet Sript :function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
//Type appropriate comment here, and begin script below
var selectedType = g_form.getValue('type');
g_form.addInfoMessage("selectedValueInClient" + selectedType);
// Fetch Questions based on the selected Type using GlideAjax
getQuestionsBasedOnType( g_form.getValue('type'), function(questions) {
// Create and show the popup
var dialog = new GlideDialogWindow('ServiceRequestGuidance');
dialog.setTitle("Legal Service Matters Detail");
dialog.render();
dialog.setWidth(600);
dialog.setHeight(400);
var html = "<div>";
for (var i = 0; i < questions.length; i++) {
var question = questions[i];
html += "<label>" + question + "</label>";
html += '<input type="text" id="question_' + i + '"/><br>';
}
html += '</div>';
dialog.renderWithContent(html);
dialog.setPreference('selectedType', selectedType);
dialog.setPreference('numOfQuestions', questions.length);
dialog.setPreference('table', "x_1296451_legaladv_servicetype");
dialog.setPreference('recordSysId', g_form.getUniqueValue());
dialog.render();
});
}
function getQuestionsBasedOnType(selectedType, callback) {
var ga = new GlideAjax('FetchPromptStrctureBasedOnChangeServiceType');
ga.addParam('sysparm_name', 'getQuestionsBasedOnType');
ga.addParam('sysparm_selectedType', selectedType);
ga.getXML(function(response) {
g_form.addInfoMessage('responseInClientSide:' + response.responseXML.documentElement.getAttribute("answer"));
if (response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
if (answer) {
var questions = answer.split(',');
callback(questions);
} else {
alert("Empty or invalid 'answer' attribute in the response from the server.");
}
} else {
alert("Empty or invalid response received from the server.");
}
});
}
==========================================================
I got the response from Script Include but Dialog box not properly render
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-08-2024 07:21 PM
your code makes no sense.
On the one hand you want to load an UI Page "ServiceRequestGuidance" via
var dialog = new GlideDialogWindow('ServiceRequestGuidance');
And on the other hand, you create custom HTML code for displaying within the modal via
dialog.renderWithContent(html);
You cannot do both approaches in parallel! Decide to either load an UI Page or render custom HTML.
Maik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-09-2024 11:44 AM
I am beginner for service now so i thought its title . now i created ui page which look like
This my client script i got null in web page where i want to show question ?