How do I use g_form with Jelly in UI macro

Woz
Tera Contributor

Hello,

I am trying to add some a CSS header to a task form.

I have created a formatter and an UI macro.

I can get the CSS to work ....

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">

    <div class="jumbotron">
        
        <h2>This CSS formatter</h2>
            
    </div>
</j:jelly>

find_real_file.png

My question is for the next part is for the next part I want to display CSS formatted data but cant find info for how to put the syntax together

I assume its something like this but I who knows? Can I display variables ? Is there any resources I Cna look at of how I can add some CSS flare to change forms

 

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">

    <div class="jumbotron">
        <script>
            var chgNumber = g_form.getElement('number');
            var chgtype = g_form.getElement('type');
        </script>
        
        //not sure w
        <h2>The change numebr is ... $chgNumber </h2>
        <h2>The change numebr is ... $chgtype </h2>
            
    </div>
</j:jelly>

 

1 ACCEPTED SOLUTION

Hi,

 

I think g_form wouldn't work on ui macro.

Follow below approach;

 <h2 id ="message1"></h2>

 <h2 id ="message2"></h2>

Write an onload client script.

document.getElementById("message1").innerHTML = g_form.getElement('number');

document.getElementById("message2").innerHTML = g_form.getElement('type');

View solution in original post

6 REPLIES 6

rahulpandey
Kilo Sage

Hi,

Use below :

 <h2>The change numebr is ... ${chgNumber} </h2>
        <h2>The change numebr is ... ${chgtype}</h2>

 

you need to use ${variable}

Woz
Tera Contributor

Hi Thanks for the reply!

instead of dispalying the var name as seen above  $chgtype is now showing blank as seen below so I assume that var chgNumber = g_form.getElement('number'); is not storing anything to var .. any thoughts why?

 

is  var chgNumber = g_form.getElement('number'); a correct way to read a value from a form?

 

Hi,

 

I think g_form wouldn't work on ui macro.

Follow below approach;

 <h2 id ="message1"></h2>

 <h2 id ="message2"></h2>

Write an onload client script.

document.getElementById("message1").innerHTML = g_form.getElement('number');

document.getElementById("message2").innerHTML = g_form.getElement('type');

Woz
Tera Contributor

Thanks! just needed to make one change - Add .value  at the end of each statement