Page 1 of 1

conditional hiding of a field in detail view

Posted: 2014-11-26 11:04
by rob parsons
Hi

I have a detail view, which contains one field I want to hide when adding a record, but show when editing. can see how to use jquery to hide, but not sure how to detect when its an insert and when its an edit. any pointers?

Re: conditional hiding of a field in detail view

Posted: 2014-11-26 13:33
by Bertv
For a new record the $data['selectedID'] is null. Maybe you can check this.

Re: conditional hiding of a field in detail view

Posted: 2014-11-26 18:41
by rob parsons
thanks, however, i have now solved this using this in noble-dv.js in my hooks folder

var nobled = document.getElementById("nobled")
if(document.getElementById("target").value=="")
{
nobled.hide();

}

simple and it works!