How to Show/hide date field in a UI page (g:ui_date_time)

roshanparumala
Kilo Explorer

I have a UI page with date time field as below:

<div class="form-group is-required row">
<label for="apt_date" class="control-label col-sm-3" style="text-align:right" id="aptdate_label">
<span class="required-marker"></span>${gs.getMessage('Appointment Date')}
</label>
<span class="col-sm-9">
<g:ui_date_time name="apt_date" query="" id="apt_date" style="width:180px"/>
</span>
</div>

 

On form load I would like to hide this date field. I have tried the below code and its not working

document.getElementById('apt_date').style.display = "none";

3 REPLIES 3

Ashutosh Munot1
Kilo Patron
Kilo Patron

Hi,

Use this field as below

<g:ui_date_time name="apt_date" query="" id="apt_date" name="apt_date" style="width:180px"/>

Then it will work.

Thanks,
Ashutosh

roshanparumala
Kilo Explorer

Hi Ashutosh,

You can see on my original post that has the Name tag.

If you want to hide a reference field you use the below code where sys_dispaly will hide the text box and lookup will hide the search button:

document.getElementById('sys_display.vendor_name').style.display = "none";
document.getElementById('lookup.vendor_name').style.display = "none";

So my requirement is to hide a ui_date_time field and looking for script to do that .

Hi,


Wrap it under an div and hide the whole div then as below:

<div id="something">

<span class="col-sm-9">
<g:ui_date_time name="apt_date" query="" id="apt_date" style="width:180px"/>
</span>

</div>

 

document.getElementById('something').style.visibility = "none";


Thanks,
Ashutosh