Tech Support > Microsoft Windows > Windows CRM > Jscript to hide fields
Jscript to hide fields
Posted by Mark Braithwaite on April 2nd, 2008


Hi

We have created two custom entities named suppliers and business partners.
We would prefer not to create account records and use the relationship type
field so we created these custom entities.

We now have on the Contact form three seperate fields that a contact could
be related to. These fields are parent customer, parent supplier and parent
business partner. A Contact should only be associated with one parent record.

We would like to write Jscript which hides the remaining fields if one of
the fields is populated. If a user associates a Contact with a parent
customer then the parent business partner and parent supplier fields are
hidden.

We have attempted to write Jscript using the On Load event but we are a bit
unsure as to how we would go about this.

We would really appreciate it if someone could take a look at the Jscript
below and point us in the right direction.

if
crmForm.all.new_parentsupplierid.DataValue != null II
crmForm.all.new_parentbusinesspartnerid.DataValue != null II
crmForm.all.parentcustomerid.DataValue != null
then
crmForm.all.new_parentsupplierid_d.style.visibilit y = ' hidden'
crmForm.all.new_parentbusinesspartnerid_d.style.vi sibility = ' hidden'
crmForm.all.parentcustomerid_d.style.visibility = ' hidden'
crmForm.all.new_parentsupplierid_c.style.visibilit y = ' hidden'
crmForm.all.new_parentbusinesspartnerid_c.style.vi sibility = ' hidden'
crmForm.all.parentcustomerid_c.style.visibility = ' hidden'

Thanks very much
Mark





Similar Posts