- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2022 10:00 AM
I had a previous question and was able to get some assistance with that.
However I am now trying to get the spModal alert to display each of the answers from my GlideAjax onto individual lines
I was able to look at the link and get the spModal,
However I am having the same issue now with the spacing
How do I get this to be with line breaks
So for each of the Conference Names I need them to be on their own line
List of Conferences already registered
My Conference
My New Event
Test
etc.. so the below would have each conference name on its own line?
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var ga = new GlideAjax('ConfAjaxUtils'); //x_btig_bookings.ChoiceAvailable
ga.addParam('sysparm_name', 'getExisting');
ga.addParam('sysparm_table', "u_conferences");
ga.getXML(getresponse);
function getresponse(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
if (answer) {
var names = + '\nng =onference Names " + '\n;' + answer);
spModal.open({
"title":" + answer);
spModal.open({
"title": "Exisitng Conference Names",
"message": "List of Conferences that have already been registered. " + names,
"buttons" : [
{label: "✘ Cancel New Registration" , primary: true},
{label: "✔ Register New Conference" , cancel: true}
],
"backdrop" : "static",
"keyboard": false
}).then(function(answer){
//g_form.setValue('license_type' , 'free');
});
}
}
}
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2022 06:39 AM
I see.
I tried the approach with the spModal and the way I got it to work, was to return all the data with line breaks, formatted as HTML, from the script include.
Can you try it that way?
So the script include should return a text that looks like this:
"Conference name 1" + "<br>" + "Conference name 2" + "<br>" + ...
In my previous response you got it working with an alert, but the difference is that the alert handles newlines differently from the spModal, so it should have text as this:
"Conference name 1" + "\n" + "Conference name 2" + "\n" + ...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2022 11:00 AM
Hi
you have to use HTML tags for formatting the message and <br> is the HTML tag for a new line.
Kind regards
Maik

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2022 11:07 AM
I also answered the follow up question the same way in the original thread... obviously not fast enough.. 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2022 09:18 AM
OlaN - Did not mean to offend you.
html in client script in not working
so adding "<br>" instead on the "\n" is not working.
I posted back in the original thread.
Thank you

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2022 12:30 AM
No worries, I'm not offended at all, I'm happy to help, anyway I can. 🙂
So your modal is working, but it's loaded when you click a button.
I'm assuming you could change the behaviour to load the modal whenever a variable changes? Have you looked at using a Catalog Client script instead?
It's hard to give good advice, since I don't have so much details on what you have to work with.
What other variables do you have on the form, how is the user supposed to interact with the form?