Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Unhide field using javascript?

Glen Collins
Contributor
September 27, 2021

Hello all! I have one question that I've been trying to work thru and no real results yet. I need to be able to unhide a field when a button is pressed and only when it's pressed upon the window draw.

I capture the button press for the record edit and I want to unhide a field called Audit. The class holding the label and textbox I can't seem to unhide using javascript, I'm missing something but I don't know what. Here is the HTML showing the item I want to show when the popup is drawn:

 

<tr class="i_holdingrow_Audit" style="border: 0px; display: none;">
<td style="width: 28%;border:0" valign="top">
<strong><label style="font-weight: bold; display: none;" id="i_labelfor_Audit" for="i_Audit">Audit </label></strong>
</td>
<td style="width: 72%;border:0;">
<span id="i_holdingrow_Audit"><textarea cf-field="Audit" id="i_Audit" name="Audit" rows="5" style="width: 98%; display: none;" class="aui textarea large-field cf_textarea"></textarea></span>
</td>

 

I tried a few things like:

AJS.$('#i_holdingrow_Audit').show();

or

document.getElementById('i_holdingrow_Audit').style.display = 'none'; 

 But it's not working. My javascript is more of hacking my way along so if someone could provide some input that would be wonderful!

I probably should note that I do hide the field (multiple fields actually) in the form using "ConfiForms Rules for Field Definition" but I want to unhide it for a specific action. I'm wondering if it's being set on pageload but being hidden again when it reaches the definition.

Thanks!

Glen

1 answer

1 accepted

0 votes
Answer accepted
Glen Collins
Contributor
September 30, 2021

This was actually simplier that I thought it would be. The answer to my question could be found here:

https://community.atlassian.com/t5/Confluence-questions/confiforms-accessing-javascript-variable/qaq-p/1817899 

Regards,

Glen

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events