- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2016 04:51 PM
New to posting to the community so please bare with me.
Use case:
User will have the ability at the top of the form that will display a pop-up window with 3 unique fields that are not located on the form. These fields will be displayed and mandatory to populate in the following order; Date/Time field, Drop Down list with 5 choices and a text field that will allow styles to retain from copy and paste from Microsoft Word or Outlook.
So based on my use case, my requirement to create a UI Page that will be called by a UI Action which will be filled out by the customer. Once the "fields" from the pop-up/GlideDialog are populated and the tech clicks "Ok", the contents of this pop-up/GlideDialog will trigger a unique event and trigger a notification which will contain fields from the form and all values from the pop-up/GlideDialog and be sent from a array of email addresses that were adding into a slush bucket.
So I have broken this down into 3 pieces to simplify the work.
1) UI Page (Incomplete)
The contents of the UI Page will have 3 fields;
- drop down list
- date/time field
- text field with TinyMCE/WYSIWYG ability
The drop down list and the date/time fields are available in HTML as a type of "datetime-local" and declaring a label with options. Those two are easy to handle, I currently have the 3rd field as a input text box. Now is the tricky part is figuring out how to make this input field into a TinyMCE/WYSIWYG field (if possible). Anyone know how to do this?
2) UI Action (Complete)
Create the UI Action that calls the UI Page as a pop-up/GlideDialog
3) Email Notification (Complete)
Triggered by the event of the UI Page Processing script
Gets the 1st and 2nd parameters (who to sent the email to and values from the ui page fields separated by "~~"
So what I am asking the community for help is with my first field and completing this requirement. Looking for the ability to use a TinyMCE or WYSIWYG in a UI Page or any type of input text box that will retain majority/all styles from Microsoft Outlook/Word Document.
Currently on Geneva Patch 7, customer will be upgrading to Helsinki within the next 2 weeks. Depending functionality, should be able to hold off till Helsinki if a solution is available.
Thank you,
Matt
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-13-2016 03:03 AM
Hi
Start by initializing the TinyMCE in the top of the UI page
<script></script>
<script>
tinymce.init({
mode : "specific_textareas",
editor_selector : "mceEditor",
width: '100%',
height: '400px',
menubar: "tools",
toolbar: "$[gs.getProperty('glide.ui.html.editor.v4.toolbar.line1')]",
content_css : "* {font: 10px arial, sans-serif;} b {font-weight:bold;} th {font-weight:bold;} strong {font-weight:bold;}",
});
</script>
Then the apply the class you specify in the "editor_selector" to the textarea
<textarea cols="80" rows="10" id="body" name="body" class="mceEditor"></textarea>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-13-2016 03:03 AM
Hi
Start by initializing the TinyMCE in the top of the UI page
<script></script>
<script>
tinymce.init({
mode : "specific_textareas",
editor_selector : "mceEditor",
width: '100%',
height: '400px',
menubar: "tools",
toolbar: "$[gs.getProperty('glide.ui.html.editor.v4.toolbar.line1')]",
content_css : "* {font: 10px arial, sans-serif;} b {font-weight:bold;} th {font-weight:bold;} strong {font-weight:bold;}",
});
</script>
Then the apply the class you specify in the "editor_selector" to the textarea
<textarea cols="80" rows="10" id="body" name="body" class="mceEditor"></textarea>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-13-2016 03:31 PM
Lars ,
Thank you for the quick reply and solution, this seems to have done the trick and works great in a global scope. I just started learning about ui pages and html, so please bare with me.
I forgot to mention this in my initial question as a possible issue.By any chance do you have any experience with using this script in a private scoped application like "Security Incident" or "HR"? When I applied this code to a private scoped application I have mixed results, I am using Helsinki as my test since the customer will be migrating to Helsinki Patch 4 in the next few weeks;
1) UI Action with a onClick "popNotification()"
function popNotification() {
var sirId = g_form.getValue("number");
alert(sirId);
var dialogClass = GlideModal ? GlideModal : GlideDialogWindow;
var gdw = new dialogClass("sn_si_send_email_popup");
//var gdw = new GlideDialogWindow('sn_si_send_email_popup'); //name of UI Page
gdw.setTitle('Send Email'); //window title
gdw.setSize(750,300); //window size in pixels
gdw.setPreference("sysparm_sir_number", sirId.toString()); //this is how you send parameter to UI Page
gdw.render(); //launch window
}
2) UI Page - HTML
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<!-- need some Jelly to wrap a form around everything so we can submit to server, there is an end tag for this below -->
<g:ui_form>
<!-- scoped applicaion approach -->
<!-- need to put jvar into html so javascript can see it - will use hidden input field -->
<input type="hidden" id="sir_number" name="sir_number" value="${sysparm_sir_number}"/>
<!-- another example of how to get parameter -->
<g:evaluate jelly="true">
var var_sir_number = jelly.sysparm_sir_number;
var_sir_number;
</g:evaluate>
<input id="loc" class="col-sm-9 form-control" type="text" name="loc" value="$[var_sir_number]" disabled="disabled"></input>
<!-- standard HTML 4 in this next section -->
<table style="width:100%;padding-right:10px;padding-left:10px;padding-bottom:10px;padding-top:10px">
<tbody>
<tr>
<td class="label label_spacing" nowrap="true" data-type="label" style="text-align:left;">
<label><span class="label_description">Email Body:</span></label>
<textarea cols="80" rows="10" id="body" name="body" class="mceEditor"></textarea>
</td>
</tr>
<tr>
<td class="label label_spacing" nowrap="true" data-type="label" style="text-align:left;">
<label><span class="label_description">Next Update:</span></label>
<input name="txtNextUpdate" id="txtNextUpdate" type="text" />$[SP]
</td>
</tr>
<tr>
<td class="label label_spacing" nowrap="true" data-type="label" style="text-align:left;">
<label><span class="label_description">Status:</span></label>
<select id="selStatus" name="selStatus">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
</select>
</td>
</tr>
</tbody>
</table>
<g:dialog_buttons_ok_cancel ok="return sendNotification();"/>
</g:ui_form>
<script></script>
<script>
tinymce.init({
mode : "specific_textareas",
editor_selector : "mceEditor",
width: 'auto',
height: 'auto',
menubar: "tools",
toolbar: "$[gs.getProperty('glide.ui.html.editor.v4.toolbar.line1')]",
content_css : "* {font: 10px arial, sans-serif;} b {font-weight:bold;} th {font-weight:bold;} strong {font-weight:bold;}",
});
</script>
</j:jelly>
This is what I was expecting when the script loaded from the UI action
But when you call the ui page from the UI Action it displays without the "text" box.
When you inspect the elements of the render window you notice there is some code that is missing from a rendered version. I also noticed the div id's numbers are different as well, but didn't focused too much on that.
Any thoughts as to why this might be occurring?
Thanks,
Matt
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-13-2016 10:33 PM
Sorry - I do not have any experience with this in a private scope
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2016 06:51 AM
Thank Lars for the follow up again. I was able to take the scripts that I wrote and your solution to my personal dev instance using both global scope and private scoped application and was able to make it work there. Now I just need to figure out is there is a plugin that might be causing this issue or a possible bug within the customers platform that could be causing these issues.
Thanks you,
Matt