Hiding a UI Checkbox in Jelly

Mike Hill1
Giga Contributor

I am working on a UI Action that copies a record.   Part of the process is to prompt the user if they want to include related records, in this case Outages.   I have an IF statement built and working, but having trouble finding the right code to hide the ui_checkbox in the first case.

<j:if test="${!jvar_gr.hasNext()}">

        <p>

        <g:ui_checkbox name="attachments" id="attachments" value="false"/>        

        <label>Attachments</label>

        </p>

</j:if>

<j:if test="${jvar_gr.next()}">

        <p>

        <g:ui_checkbox name="attachments" id="attachments" value="true"/>

        <label>Attachments</label>

        </p>

</j:if>

For line 3 - is there a tag/label I can add that makes the ui_checkbox hidden?   It is setting the value correctly to true or false, but I want it to be completely hidden on false.   Can't just omit it because I need to call it in the Processing Script, but I don't want the user to see it either.

I tried [display="false"] & [visible="false"] & [visibility="false"] but no luck.   Appreciate any help you can provide!

1 ACCEPTED SOLUTION

Abhinay Erra
Giga Sage

<j:if test="${!jvar_gr.hasNext()}">  


        <p style="display:none">  


        <g:ui_checkbox name="attachments" id="attachments" value="false"/>            


        <label>Attachments</label>  


        </p>  


</j:if>  


 


<j:if test="${jvar_gr.next()}">  


        <p   style="display:block">  


        <g:ui_checkbox name="attachments" id="attachments" value="true"/>    


        <label>Attachments</label>  


        </p>  


</j:if>  


View solution in original post

5 REPLIES 5

Chuck Tomasi
Tera Patron

Hi Michael,



If you cannot omit it, then your ! statement isn't going to be what you want. That's processed on the server before it's sent to the client browser, so it would be missing.



I recommend using a <div> tag with a class and the CSS to hide it when you want.



See this: CSS Layout - The display Property


Chuck,



Not sure I follow that the if statement check isn't the option - I am doing a check above for the existence of related records in a different table.   If there are not matches (line 1 above) then the value should be set to false and the checkbox should be hidden.   I still need to do the calculation on the server side because it is looking up records on another table.



All that being said, I am fairly new to CSS as well.   If you could mock up a very brief example that might help me grasp it as a potential solution.   Thank you for taking the time to reply.


Abhinay Erra
Giga Sage

<j:if test="${!jvar_gr.hasNext()}">  


        <p style="display:none">  


        <g:ui_checkbox name="attachments" id="attachments" value="false"/>            


        <label>Attachments</label>  


        </p>  


</j:if>  


 


<j:if test="${jvar_gr.next()}">  


        <p   style="display:block">  


        <g:ui_checkbox name="attachments" id="attachments" value="true"/>    


        <label>Attachments</label>  


        </p>  


</j:if>  


Thank you!   Adding the style to the paragraph works!