Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

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

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.

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)

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! 

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence Cloud

Get to know the Confluence team!

Go “behind the screen” to meet some of the Confluence Cloud team. In this video series, we tackle some of the hard-hitting questions you never knew you wanted the answer to!  Meet some of the ...

236 views 0 10
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you