Ui page field hide / show according to condition

svani
Tera Contributor

HI ,

i have a query to make ui page hide or show with respect to changes in some field.

Like i have jira issue type should be shown only when jira project is selected until that is changes it should not shown even at load as well.

 

i have tried to write the below code in client script not working.Please help if anyone has any idea.

 

below is the code:

HTML:

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:evaluate var="jvar_taskId" expression="RP.getWindowProperties().get('sysId')" />
    <input type="hidden" id="hidden_sys_id" name="hidden_sys_id" value="${jvar_taskId}"></input>
<g:ui_form>
<table style="width:700px;">
<tr>
<td style="width:25%">
<g:form_label>
Project Name :
</g:form_label>
</td>
<td style="width:60%">
<g:ui_reference name="project_ref" id="project_ref" query="u_jira_project_nameISNOTEMPTY" table="sn_jira_spoke_jira_to_servicenow_projects" onchange="setIssueTypeFilter()" />
</td>
</tr>
<tr>
<td style="width:25%">
<g:form_label>
Issue Type :
</g:form_label>
</td>
<td style="width:60%">
<g:ui_reference name="issue_ref" id="issue_ref" table="sn_jira_spoke_issue_types_from_jira_project" />
</td>
</tr>
<tr>
<td>
<g:dialog_buttons_ok_cancel ok_id="submitData" ok="return continueOK()" ok_type="button" ok_text="${gs.getMessage('okay')}" ok_style_class="btn btn-primary" cancel_type="button" cancel_id="cancelData" cancel_style_class="btn btn-default" cancel="return continueCancel()"/>
</td>
</tr>
</table>
</g:ui_form>
   </j:jelly>
 
client script:
var projNamehide = gel('project_ref').value;
 alert(projNamehide);
 if(projNamehide == '')
 {
    gel('issue_ref').style.display = 'none';
 }else{
    gel('issue_ref').style.display = '';
 }
 
/////still have another code for issue creation and all
 

 

10 REPLIES 10

svani
Tera Contributor

Hi,

i have cleared the error just by doing like below.

if (document.getElementById('issue_ref'))
        {
        gel('initialhide').style.display = "none";
    }
thanks,
Svani