How to pass a parameter to a html field in a UI page? (semi easy points)

juan casas
Mega Expert

How to pass a parameter to a tinymce in a UI page?


I am passing the following info through a UI action as follow:

function openUIPage() {
    var dialog = new GlideDialogWindow('x_banun_creops_ui_page_demo'); 
    dialog.setTitle("TITLE")); //Set the dialog title
    dialog.setPreference('sysparm_emailbody', g_form.getValue('email_body') ); 
    dialog.render(); //Open the dialog   
}


How do I pass that into a UI page that has the following TinyMCE?

 

<g:evaluate var="jvar_email_body" expression="RP.getWindowProperties().get('sysparm_emailbody')" />

    <script>
        tinymce.init({
        mode : "specific_textareas",
        editor_selector : "mce",
        width: '100%',
        height: '300px',

        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>
<textarea cols="80" rows="10" id="myArea2" name="myArea"  class="mce"></textarea>

 

 

I tried to do value="${sysparm_emailbody}" but I had no luck!

 

 

SO I want to see the value that I passed inside the tinymce field.

1 ACCEPTED SOLUTION

@juan casas  use this between <textarea> tags like below and try

 

<textarea cols="80" rows="10" id="myArea2" name="myArea"  class="mce">

${jvar_v1}

</textarea>

View solution in original post

5 REPLIES 5

Mohith Devatte
Tera Sage
Tera Sage

hello @juan casas you can use below format for this

This line will get the value from UI action

<g:evaluate var="jvar_v1" expression="RP.getWindowProperties().get('sysparm_emailbody')" />

This line will Print your value that you tried to access from UI action parameters

<span id="var1">${jvar_v1}</span>
Please mark the answer correct if it helps you

@Mohith Devatte I understand how to pass the param, what I want to know is how to insert it inside the tinymce field

@juan casas  use this between <textarea> tags like below and try

 

<textarea cols="80" rows="10" id="myArea2" name="myArea"  class="mce">

${jvar_v1}

</textarea>

@Mohith Devatte I didnt write the question the best format, my bad. I updated the question