Retaining JavaScript Show/hide rules when editing in Table View Macro

Jason Walsh
Contributor
October 5, 2020

Looking for a little assistance. 

I have a confiform form on a Confluence page where I'm running some JavaScript to hide fields on the form

Example:

<script type="text/javascript">

jQuery(document).ready(function($) {
   // hide all optional elements
    $('#i_labelfor_jirakey').hide();
    $('#i_holdingrow_jirakey').hide();
    $('#i_labelfor_approvalsheader').hide();
etc....

On a child page, I've created a table view macro to display the form fields to allow for editing.  Problem is that the hidden fields are not hidden when opening up the form from the "edit" button on the Table View macro. 

I've tried copying and pasting over the JS code to the page where the Table View macro is but nothing seems to work. 

Hoping it's something simple that I'm just not seeing / picking up on. Any help is appreciated!

2 answers

2 accepted

0 votes
Answer accepted
Alex Medved _ConfiForms_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 6, 2020

For hiding the fields in ConfiForms Forms please use the ConfiForms Field Definition Rules.

As Adrian has mentioned the script you have runs on a page load, but the form is rarely loaded on page load (unless it is embedded)

Jason Walsh
Contributor
October 6, 2020

Using the pure CSS solution worked but by hiding the holding row class as opposed to the id. Doing this makes it so that if I click "edit" on a record displayed by a Table View Macro, the CSS is able to hide the fields in the form that pops up.

My solution:

<style>
.i_holdingrow_jirakey,
.i_holdingrow_approvalsheader {


    display: none;

}
</style>

Thank you both for steering me in the right direction! 

0 votes
Answer accepted
Adrian Moerchen
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 5, 2020

Why are you using JavaScript? 

Can't you solve your problem with pure CSS, i.e.

<style>
#i_holdingrow_jirakey,
#i_holdingrow_jirakey,
#i_labelfor_approvalsheader {


    display: none;

}
</style>

 

The elements may have other selectors in edit mode. The problem with your JavaScript is, that it just works once - when the page is loaded.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events