Jscript to hide unpopulated fields

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. 

If I use the On Save event, the question is, how do I hide the remaining 
fields if a certain value is selected in one of the fields? I only want to 
hide the fields that are not populated. 

I suppose I could use a script which if all fields are null then do nothing 
however if one of the fields are populated then hide the fields that are 
null. How would you translate this into Jscript? 

I created a custom field named 'Contact Type' and tested the following script:

var type = crmForm.all.new_contacttype.SelectedText;
switch (type)
{ 
case "Business Partner
crmForm.all.parentcustomerid.style.visibility = 'hidden';
crmForm.all.parentcustomerid.style.position = 'absolute';
crmForm.all.parentcustomerid_c.style.visibility = 'hidden';
crmForm.all.parentcustomerid_c.style.position = 'absolute';
crmForm.all.parentcustomerid_d.style.visibility = 'hidden';
crmForm.all.parentcustomerid_d.style.position = 'absolute';
crmForm.all.new_parentbusinesspartnerid.style.visibility = 'visible';
crmForm.all.new_parentbusinesspartnerid.style.position = 'relative';
crmForm.all.new_parentbusinesspartnerid_c.style.visibility = 'visible';
crmForm.all.new_parentbusinesspartnerid_c.style.position = 'relative';
crmForm.all.new_parentbusinesspartnerid_d.style.visibility = 'visible';
crmForm.all.new_parentbusinesspartnerid_d.style.position = 'relative'; 
crmForm.all.new_parentsupplierid.style.visibility = 'hidden';
crmForm.all.new_parentsupplierid.style.position = 'absolute';
crmForm.all.new_parentsupplierid_c.style.visibility = 'hidden';
crmForm.all.new_parentsupplierid_c.style.position = 'absolute';
crmForm.all.new_parentsupplierid_d.style.visibility = 'hidden';
crmForm.all.new_parentsupplierid_d.style.position = 'absolute'; 

case "Supplier"
crmForm.all.parentcustomerid.style.visibility = 'hidden';
crmForm.all.parentcustomerid.style.position = 'absolute';
crmForm.all.parentcustomerid_c.style.visibility = 'hidden';
crmForm.all.parentcustomerid_c.style.position = 'absolute';
crmForm.all.parentcustomerid_d.style.visibility = 'hidden';
crmForm.all.parentcustomerid_d.style.position = 'absolute';
crmForm.all.new_parentbusinesspartnerid.style.visibility = 'hidden';
crmForm.all.new_parentbusinesspartnerid.style.position = 'absolute';
crmForm.all.new_parentbusinesspartnerid_c.style.visibility = 'hidden';
crmForm.all.new_parentbusinesspartnerid_c.style.position = 'absolute';
crmForm.all.new_parentbusinesspartnerid_d.style.visibility = 'hidden';
crmForm.all.new_parentbusinesspartnerid_d.style.position = 'absolute'; 
crmForm.all.new_parentsupplierid.style.visibility = 'visible';
crmForm.all.new_parentsupplierid.style.position = 'relative';
crmForm.all.new_parentsupplierid_c.style.visibility = 'visible';
crmForm.all.new_parentsupplierid_c.style.position = 'relative';
crmForm.all.new_parentsupplierid_d.style.visibility = 'visible;
crmForm.all.new_parentsupplierid_d.style.position = 'relative';
break;

case "Customer"
crmForm.all.parentcustomerid.style.visibility = 'visible';
crmForm.all.parentcustomerid.style.position = 'relative';
crmForm.all.parentcustomerid_c.style.visibility = 'visible';
crmForm.all.parentcustomerid_c.style.position = 'relative';
crmForm.all.parentcustomerid_d.style.visibility = 'visible';
crmForm.all.parentcustomerid_d.style.position = 'relative';
crmForm.all.new_parentbusinesspartnerid.style.visibility = 'hidden';
crmForm.all.new_parentbusinesspartnerid.style.position = 'absolute';
crmForm.all.new_parentbusinesspartnerid_c.style.visibility = 'hidden';
crmForm.all.new_parentbusinesspartnerid_c.style.position = 'absolute';
crmForm.all.new_parentbusinesspartnerid_d.style.visibility = 'hidden';
crmForm.all.new_parentbusinesspartnerid_d.style.position = 'absolute'; 
crmForm.all.new_parentsupplierid.style.visibility = 'hidden';
crmForm.all.new_parentsupplierid.style.position = 'absolute';
crmForm.all.new_parentsupplierid_c.style.visibility = 'hidden';
crmForm.all.new_parentsupplierid_c.style.position = 'absolute';
crmForm.all.new_parentsupplierid_d.style.visibility = 'hidden';
crmForm.all.new_parentsupplierid_d.style.position = 'absolute';
break;

This script was unsuccessful and I would ideally prefer not to create the 
custom field named 'Contact Type'.

Thanks very much


0
4/8/2008 8:57:00 AM
crm 35858 articles. 1 followers. Follow

11 Replies
438 Views

Similar Articles

[PageSpeed] 48

Hi Mark,

How about using If..then constructs to check if a value is present in one of 
the three lookup fields?

To get the value in a lookup, you would need to use:
crmForm.all.lookupfield.nextSibling.InnerText

Do write in if you have problems using this script.

HTH,
Niths

"Mark Braithwaite" wrote:

> 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. 
> 
> If I use the On Save event, the question is, how do I hide the remaining 
> fields if a certain value is selected in one of the fields? I only want to 
> hide the fields that are not populated. 
> 
> I suppose I could use a script which if all fields are null then do nothing 
> however if one of the fields are populated then hide the fields that are 
> null. How would you translate this into Jscript? 
> 
> I created a custom field named 'Contact Type' and tested the following script:
> 
> var type = crmForm.all.new_contacttype.SelectedText;
> switch (type)
> { 
> case "Business Partner
> crmForm.all.parentcustomerid.style.visibility = 'hidden';
> crmForm.all.parentcustomerid.style.position = 'absolute';
> crmForm.all.parentcustomerid_c.style.visibility = 'hidden';
> crmForm.all.parentcustomerid_c.style.position = 'absolute';
> crmForm.all.parentcustomerid_d.style.visibility = 'hidden';
> crmForm.all.parentcustomerid_d.style.position = 'absolute';
> crmForm.all.new_parentbusinesspartnerid.style.visibility = 'visible';
> crmForm.all.new_parentbusinesspartnerid.style.position = 'relative';
> crmForm.all.new_parentbusinesspartnerid_c.style.visibility = 'visible';
> crmForm.all.new_parentbusinesspartnerid_c.style.position = 'relative';
> crmForm.all.new_parentbusinesspartnerid_d.style.visibility = 'visible';
> crmForm.all.new_parentbusinesspartnerid_d.style.position = 'relative'; 
> crmForm.all.new_parentsupplierid.style.visibility = 'hidden';
> crmForm.all.new_parentsupplierid.style.position = 'absolute';
> crmForm.all.new_parentsupplierid_c.style.visibility = 'hidden';
> crmForm.all.new_parentsupplierid_c.style.position = 'absolute';
> crmForm.all.new_parentsupplierid_d.style.visibility = 'hidden';
> crmForm.all.new_parentsupplierid_d.style.position = 'absolute'; 
> 
> case "Supplier"
> crmForm.all.parentcustomerid.style.visibility = 'hidden';
> crmForm.all.parentcustomerid.style.position = 'absolute';
> crmForm.all.parentcustomerid_c.style.visibility = 'hidden';
> crmForm.all.parentcustomerid_c.style.position = 'absolute';
> crmForm.all.parentcustomerid_d.style.visibility = 'hidden';
> crmForm.all.parentcustomerid_d.style.position = 'absolute';
> crmForm.all.new_parentbusinesspartnerid.style.visibility = 'hidden';
> crmForm.all.new_parentbusinesspartnerid.style.position = 'absolute';
> crmForm.all.new_parentbusinesspartnerid_c.style.visibility = 'hidden';
> crmForm.all.new_parentbusinesspartnerid_c.style.position = 'absolute';
> crmForm.all.new_parentbusinesspartnerid_d.style.visibility = 'hidden';
> crmForm.all.new_parentbusinesspartnerid_d.style.position = 'absolute'; 
> crmForm.all.new_parentsupplierid.style.visibility = 'visible';
> crmForm.all.new_parentsupplierid.style.position = 'relative';
> crmForm.all.new_parentsupplierid_c.style.visibility = 'visible';
> crmForm.all.new_parentsupplierid_c.style.position = 'relative';
> crmForm.all.new_parentsupplierid_d.style.visibility = 'visible;
> crmForm.all.new_parentsupplierid_d.style.position = 'relative';
> break;
> 
> case "Customer"
> crmForm.all.parentcustomerid.style.visibility = 'visible';
> crmForm.all.parentcustomerid.style.position = 'relative';
> crmForm.all.parentcustomerid_c.style.visibility = 'visible';
> crmForm.all.parentcustomerid_c.style.position = 'relative';
> crmForm.all.parentcustomerid_d.style.visibility = 'visible';
> crmForm.all.parentcustomerid_d.style.position = 'relative';
> crmForm.all.new_parentbusinesspartnerid.style.visibility = 'hidden';
> crmForm.all.new_parentbusinesspartnerid.style.position = 'absolute';
> crmForm.all.new_parentbusinesspartnerid_c.style.visibility = 'hidden';
> crmForm.all.new_parentbusinesspartnerid_c.style.position = 'absolute';
> crmForm.all.new_parentbusinesspartnerid_d.style.visibility = 'hidden';
> crmForm.all.new_parentbusinesspartnerid_d.style.position = 'absolute'; 
> crmForm.all.new_parentsupplierid.style.visibility = 'hidden';
> crmForm.all.new_parentsupplierid.style.position = 'absolute';
> crmForm.all.new_parentsupplierid_c.style.visibility = 'hidden';
> crmForm.all.new_parentsupplierid_c.style.position = 'absolute';
> crmForm.all.new_parentsupplierid_d.style.visibility = 'hidden';
> crmForm.all.new_parentsupplierid_d.style.position = 'absolute';
> break;
> 
> This script was unsuccessful and I would ideally prefer not to create the 
> custom field named 'Contact Type'.
> 
> Thanks very much
> 
> 
0
Niths (71)
4/9/2008 7:55:00 AM
Hi Niths

Thanks for your reply. Okay so the begining of part of my script would be 
if 
crmForm.all.new_parentsupplierid.nextSibling.InnerText II
crmForm.all.new_parentbusinesspartnerid.nextSibling.InnerText II
crmForm.all.parentcustomerid.nextSibling.InnerText != null 
then ........

My question is how do I hide only the fields that are null if one of them is 
populated. To be honest I may be lacking the skills to write the Jscript 
required. Appreciate your assistance.

Thanks again
Mark

"Niths" wrote:

> Hi Mark,
> 
> How about using If..then constructs to check if a value is present in one of 
> the three lookup fields?
> 
> To get the value in a lookup, you would need to use:
> crmForm.all.lookupfield.nextSibling.InnerText
> 
> Do write in if you have problems using this script.
> 
> HTH,
> Niths
> 
> "Mark Braithwaite" wrote:
> 
> > 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. 
> > 
> > If I use the On Save event, the question is, how do I hide the remaining 
> > fields if a certain value is selected in one of the fields? I only want to 
> > hide the fields that are not populated. 
> > 
> > I suppose I could use a script which if all fields are null then do nothing 
> > however if one of the fields are populated then hide the fields that are 
> > null. How would you translate this into Jscript? 
> > 
> > I created a custom field named 'Contact Type' and tested the following script:
> > 
> > var type = crmForm.all.new_contacttype.SelectedText;
> > switch (type)
> > { 
> > case "Business Partner
> > crmForm.all.parentcustomerid.style.visibility = 'hidden';
> > crmForm.all.parentcustomerid.style.position = 'absolute';
> > crmForm.all.parentcustomerid_c.style.visibility = 'hidden';
> > crmForm.all.parentcustomerid_c.style.position = 'absolute';
> > crmForm.all.parentcustomerid_d.style.visibility = 'hidden';
> > crmForm.all.parentcustomerid_d.style.position = 'absolute';
> > crmForm.all.new_parentbusinesspartnerid.style.visibility = 'visible';
> > crmForm.all.new_parentbusinesspartnerid.style.position = 'relative';
> > crmForm.all.new_parentbusinesspartnerid_c.style.visibility = 'visible';
> > crmForm.all.new_parentbusinesspartnerid_c.style.position = 'relative';
> > crmForm.all.new_parentbusinesspartnerid_d.style.visibility = 'visible';
> > crmForm.all.new_parentbusinesspartnerid_d.style.position = 'relative'; 
> > crmForm.all.new_parentsupplierid.style.visibility = 'hidden';
> > crmForm.all.new_parentsupplierid.style.position = 'absolute';
> > crmForm.all.new_parentsupplierid_c.style.visibility = 'hidden';
> > crmForm.all.new_parentsupplierid_c.style.position = 'absolute';
> > crmForm.all.new_parentsupplierid_d.style.visibility = 'hidden';
> > crmForm.all.new_parentsupplierid_d.style.position = 'absolute'; 
> > 
> > case "Supplier"
> > crmForm.all.parentcustomerid.style.visibility = 'hidden';
> > crmForm.all.parentcustomerid.style.position = 'absolute';
> > crmForm.all.parentcustomerid_c.style.visibility = 'hidden';
> > crmForm.all.parentcustomerid_c.style.position = 'absolute';
> > crmForm.all.parentcustomerid_d.style.visibility = 'hidden';
> > crmForm.all.parentcustomerid_d.style.position = 'absolute';
> > crmForm.all.new_parentbusinesspartnerid.style.visibility = 'hidden';
> > crmForm.all.new_parentbusinesspartnerid.style.position = 'absolute';
> > crmForm.all.new_parentbusinesspartnerid_c.style.visibility = 'hidden';
> > crmForm.all.new_parentbusinesspartnerid_c.style.position = 'absolute';
> > crmForm.all.new_parentbusinesspartnerid_d.style.visibility = 'hidden';
> > crmForm.all.new_parentbusinesspartnerid_d.style.position = 'absolute'; 
> > crmForm.all.new_parentsupplierid.style.visibility = 'visible';
> > crmForm.all.new_parentsupplierid.style.position = 'relative';
> > crmForm.all.new_parentsupplierid_c.style.visibility = 'visible';
> > crmForm.all.new_parentsupplierid_c.style.position = 'relative';
> > crmForm.all.new_parentsupplierid_d.style.visibility = 'visible;
> > crmForm.all.new_parentsupplierid_d.style.position = 'relative';
> > break;
> > 
> > case "Customer"
> > crmForm.all.parentcustomerid.style.visibility = 'visible';
> > crmForm.all.parentcustomerid.style.position = 'relative';
> > crmForm.all.parentcustomerid_c.style.visibility = 'visible';
> > crmForm.all.parentcustomerid_c.style.position = 'relative';
> > crmForm.all.parentcustomerid_d.style.visibility = 'visible';
> > crmForm.all.parentcustomerid_d.style.position = 'relative';
> > crmForm.all.new_parentbusinesspartnerid.style.visibility = 'hidden';
> > crmForm.all.new_parentbusinesspartnerid.style.position = 'absolute';
> > crmForm.all.new_parentbusinesspartnerid_c.style.visibility = 'hidden';
> > crmForm.all.new_parentbusinesspartnerid_c.style.position = 'absolute';
> > crmForm.all.new_parentbusinesspartnerid_d.style.visibility = 'hidden';
> > crmForm.all.new_parentbusinesspartnerid_d.style.position = 'absolute'; 
> > crmForm.all.new_parentsupplierid.style.visibility = 'hidden';
> > crmForm.all.new_parentsupplierid.style.position = 'absolute';
> > crmForm.all.new_parentsupplierid_c.style.visibility = 'hidden';
> > crmForm.all.new_parentsupplierid_c.style.position = 'absolute';
> > crmForm.all.new_parentsupplierid_d.style.visibility = 'hidden';
> > crmForm.all.new_parentsupplierid_d.style.position = 'absolute';
> > break;
> > 
> > This script was unsuccessful and I would ideally prefer not to create the 
> > custom field named 'Contact Type'.
> > 
> > Thanks very much
> > 
> > 
0
4/9/2008 8:16:03 AM
Hi Niths

Thanks for your reply. Okay so the begining of part of my script would be 
if 
crmForm.all.new_parentsupplierid.nextSibling.InnerText II
crmForm.all.new_parentbusinesspartnerid.nextSibling.InnerText II
crmForm.all.parentcustomerid.nextSibling.InnerText != null 
then ........

My question is how do I hide only the fields that are null if one of them is 
populated. To be honest I may be lacking the skills to write the Jscript 
required. Appreciate your assistance.

Thanks again
Mark

"Niths" wrote:

> Hi Mark,
> 
> How about using If..then constructs to check if a value is present in one of 
> the three lookup fields?
> 
> To get the value in a lookup, you would need to use:
> crmForm.all.lookupfield.nextSibling.InnerText
> 
> Do write in if you have problems using this script.
> 
> HTH,
> Niths
> 
> "Mark Braithwaite" wrote:
> 
> > 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. 
> > 
> > If I use the On Save event, the question is, how do I hide the remaining 
> > fields if a certain value is selected in one of the fields? I only want to 
> > hide the fields that are not populated. 
> > 
> > I suppose I could use a script which if all fields are null then do nothing 
> > however if one of the fields are populated then hide the fields that are 
> > null. How would you translate this into Jscript? 
> > 
> > I created a custom field named 'Contact Type' and tested the following script:
> > 
> > var type = crmForm.all.new_contacttype.SelectedText;
> > switch (type)
> > { 
> > case "Business Partner
> > crmForm.all.parentcustomerid.style.visibility = 'hidden';
> > crmForm.all.parentcustomerid.style.position = 'absolute';
> > crmForm.all.parentcustomerid_c.style.visibility = 'hidden';
> > crmForm.all.parentcustomerid_c.style.position = 'absolute';
> > crmForm.all.parentcustomerid_d.style.visibility = 'hidden';
> > crmForm.all.parentcustomerid_d.style.position = 'absolute';
> > crmForm.all.new_parentbusinesspartnerid.style.visibility = 'visible';
> > crmForm.all.new_parentbusinesspartnerid.style.position = 'relative';
> > crmForm.all.new_parentbusinesspartnerid_c.style.visibility = 'visible';
> > crmForm.all.new_parentbusinesspartnerid_c.style.position = 'relative';
> > crmForm.all.new_parentbusinesspartnerid_d.style.visibility = 'visible';
> > crmForm.all.new_parentbusinesspartnerid_d.style.position = 'relative'; 
> > crmForm.all.new_parentsupplierid.style.visibility = 'hidden';
> > crmForm.all.new_parentsupplierid.style.position = 'absolute';
> > crmForm.all.new_parentsupplierid_c.style.visibility = 'hidden';
> > crmForm.all.new_parentsupplierid_c.style.position = 'absolute';
> > crmForm.all.new_parentsupplierid_d.style.visibility = 'hidden';
> > crmForm.all.new_parentsupplierid_d.style.position = 'absolute'; 
> > 
> > case "Supplier"
> > crmForm.all.parentcustomerid.style.visibility = 'hidden';
> > crmForm.all.parentcustomerid.style.position = 'absolute';
> > crmForm.all.parentcustomerid_c.style.visibility = 'hidden';
> > crmForm.all.parentcustomerid_c.style.position = 'absolute';
> > crmForm.all.parentcustomerid_d.style.visibility = 'hidden';
> > crmForm.all.parentcustomerid_d.style.position = 'absolute';
> > crmForm.all.new_parentbusinesspartnerid.style.visibility = 'hidden';
> > crmForm.all.new_parentbusinesspartnerid.style.position = 'absolute';
> > crmForm.all.new_parentbusinesspartnerid_c.style.visibility = 'hidden';
> > crmForm.all.new_parentbusinesspartnerid_c.style.position = 'absolute';
> > crmForm.all.new_parentbusinesspartnerid_d.style.visibility = 'hidden';
> > crmForm.all.new_parentbusinesspartnerid_d.style.position = 'absolute'; 
> > crmForm.all.new_parentsupplierid.style.visibility = 'visible';
> > crmForm.all.new_parentsupplierid.style.position = 'relative';
> > crmForm.all.new_parentsupplierid_c.style.visibility = 'visible';
> > crmForm.all.new_parentsupplierid_c.style.position = 'relative';
> > crmForm.all.new_parentsupplierid_d.style.visibility = 'visible;
> > crmForm.all.new_parentsupplierid_d.style.position = 'relative';
> > break;
> > 
> > case "Customer"
> > crmForm.all.parentcustomerid.style.visibility = 'visible';
> > crmForm.all.parentcustomerid.style.position = 'relative';
> > crmForm.all.parentcustomerid_c.style.visibility = 'visible';
> > crmForm.all.parentcustomerid_c.style.position = 'relative';
> > crmForm.all.parentcustomerid_d.style.visibility = 'visible';
> > crmForm.all.parentcustomerid_d.style.position = 'relative';
> > crmForm.all.new_parentbusinesspartnerid.style.visibility = 'hidden';
> > crmForm.all.new_parentbusinesspartnerid.style.position = 'absolute';
> > crmForm.all.new_parentbusinesspartnerid_c.style.visibility = 'hidden';
> > crmForm.all.new_parentbusinesspartnerid_c.style.position = 'absolute';
> > crmForm.all.new_parentbusinesspartnerid_d.style.visibility = 'hidden';
> > crmForm.all.new_parentbusinesspartnerid_d.style.position = 'absolute'; 
> > crmForm.all.new_parentsupplierid.style.visibility = 'hidden';
> > crmForm.all.new_parentsupplierid.style.position = 'absolute';
> > crmForm.all.new_parentsupplierid_c.style.visibility = 'hidden';
> > crmForm.all.new_parentsupplierid_c.style.position = 'absolute';
> > crmForm.all.new_parentsupplierid_d.style.visibility = 'hidden';
> > crmForm.all.new_parentsupplierid_d.style.position = 'absolute';
> > break;
> > 
> > This script was unsuccessful and I would ideally prefer not to create the 
> > custom field named 'Contact Type'.
> > 
> > Thanks very much
> > 
> > 
0
4/9/2008 8:16:06 AM
Hi Mark,

Try this:

var lkupval1 = crmForm.all.new_parentsupplierid.DataValue;

if (lkupval1[0] != null) 
{
    crmForm.all.new_parentbusinesspartnerid_c.style.display="none";
    crmForm.all.new_parentbusinesspartnerid_d.style.display="none";
    crmForm.all.new_parentcustomerid_c.style.display="none";
    crmForm.all.new_parentcustomerid_d.style.display="none";
}

and likewise for the parentbusinesspartnerid and parentcustomerid fields.

HTH,
Niths

"Mark Braithwaite" wrote:

> Hi Niths
> 
> Thanks for your reply. Okay so the begining of part of my script would be 
> if 
> crmForm.all.new_parentsupplierid.nextSibling.InnerText II
> crmForm.all.new_parentbusinesspartnerid.nextSibling.InnerText II
> crmForm.all.parentcustomerid.nextSibling.InnerText != null 
> then ........
> 
> My question is how do I hide only the fields that are null if one of them is 
> populated. To be honest I may be lacking the skills to write the Jscript 
> required. Appreciate your assistance.
> 
> Thanks again
> Mark
> 
> "Niths" wrote:
> 
> > Hi Mark,
> > 
> > How about using If..then constructs to check if a value is present in one of 
> > the three lookup fields?
> > 
> > To get the value in a lookup, you would need to use:
> > crmForm.all.lookupfield.nextSibling.InnerText
> > 
> > Do write in if you have problems using this script.
> > 
> > HTH,
> > Niths
> > 
> > "Mark Braithwaite" wrote:
> > 
> > > 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. 
> > > 
> > > If I use the On Save event, the question is, how do I hide the remaining 
> > > fields if a certain value is selected in one of the fields? I only want to 
> > > hide the fields that are not populated. 
> > > 
> > > I suppose I could use a script which if all fields are null then do nothing 
> > > however if one of the fields are populated then hide the fields that are 
> > > null. How would you translate this into Jscript? 
> > > 
> > > I created a custom field named 'Contact Type' and tested the following script:
> > > 
> > > var type = crmForm.all.new_contacttype.SelectedText;
> > > switch (type)
> > > { 
> > > case "Business Partner
> > > crmForm.all.parentcustomerid.style.visibility = 'hidden';
> > > crmForm.all.parentcustomerid.style.position = 'absolute';
> > > crmForm.all.parentcustomerid_c.style.visibility = 'hidden';
> > > crmForm.all.parentcustomerid_c.style.position = 'absolute';
> > > crmForm.all.parentcustomerid_d.style.visibility = 'hidden';
> > > crmForm.all.parentcustomerid_d.style.position = 'absolute';
> > > crmForm.all.new_parentbusinesspartnerid.style.visibility = 'visible';
> > > crmForm.all.new_parentbusinesspartnerid.style.position = 'relative';
> > > crmForm.all.new_parentbusinesspartnerid_c.style.visibility = 'visible';
> > > crmForm.all.new_parentbusinesspartnerid_c.style.position = 'relative';
> > > crmForm.all.new_parentbusinesspartnerid_d.style.visibility = 'visible';
> > > crmForm.all.new_parentbusinesspartnerid_d.style.position = 'relative'; 
> > > crmForm.all.new_parentsupplierid.style.visibility = 'hidden';
> > > crmForm.all.new_parentsupplierid.style.position = 'absolute';
> > > crmForm.all.new_parentsupplierid_c.style.visibility = 'hidden';
> > > crmForm.all.new_parentsupplierid_c.style.position = 'absolute';
> > > crmForm.all.new_parentsupplierid_d.style.visibility = 'hidden';
> > > crmForm.all.new_parentsupplierid_d.style.position = 'absolute'; 
> > > 
> > > case "Supplier"
> > > crmForm.all.parentcustomerid.style.visibility = 'hidden';
> > > crmForm.all.parentcustomerid.style.position = 'absolute';
> > > crmForm.all.parentcustomerid_c.style.visibility = 'hidden';
> > > crmForm.all.parentcustomerid_c.style.position = 'absolute';
> > > crmForm.all.parentcustomerid_d.style.visibility = 'hidden';
> > > crmForm.all.parentcustomerid_d.style.position = 'absolute';
> > > crmForm.all.new_parentbusinesspartnerid.style.visibility = 'hidden';
> > > crmForm.all.new_parentbusinesspartnerid.style.position = 'absolute';
> > > crmForm.all.new_parentbusinesspartnerid_c.style.visibility = 'hidden';
> > > crmForm.all.new_parentbusinesspartnerid_c.style.position = 'absolute';
> > > crmForm.all.new_parentbusinesspartnerid_d.style.visibility = 'hidden';
> > > crmForm.all.new_parentbusinesspartnerid_d.style.position = 'absolute'; 
> > > crmForm.all.new_parentsupplierid.style.visibility = 'visible';
> > > crmForm.all.new_parentsupplierid.style.position = 'relative';
> > > crmForm.all.new_parentsupplierid_c.style.visibility = 'visible';
> > > crmForm.all.new_parentsupplierid_c.style.position = 'relative';
> > > crmForm.all.new_parentsupplierid_d.style.visibility = 'visible;
> > > crmForm.all.new_parentsupplierid_d.style.position = 'relative';
> > > break;
> > > 
> > > case "Customer"
> > > crmForm.all.parentcustomerid.style.visibility = 'visible';
> > > crmForm.all.parentcustomerid.style.position = 'relative';
> > > crmForm.all.parentcustomerid_c.style.visibility = 'visible';
> > > crmForm.all.parentcustomerid_c.style.position = 'relative';
> > > crmForm.all.parentcustomerid_d.style.visibility = 'visible';
> > > crmForm.all.parentcustomerid_d.style.position = 'relative';
> > > crmForm.all.new_parentbusinesspartnerid.style.visibility = 'hidden';
> > > crmForm.all.new_parentbusinesspartnerid.style.position = 'absolute';
> > > crmForm.all.new_parentbusinesspartnerid_c.style.visibility = 'hidden';
> > > crmForm.all.new_parentbusinesspartnerid_c.style.position = 'absolute';
> > > crmForm.all.new_parentbusinesspartnerid_d.style.visibility = 'hidden';
> > > crmForm.all.new_parentbusinesspartnerid_d.style.position = 'absolute'; 
> > > crmForm.all.new_parentsupplierid.style.visibility = 'hidden';
> > > crmForm.all.new_parentsupplierid.style.position = 'absolute';
> > > crmForm.all.new_parentsupplierid_c.style.visibility = 'hidden';
> > > crmForm.all.new_parentsupplierid_c.style.position = 'absolute';
> > > crmForm.all.new_parentsupplierid_d.style.visibility = 'hidden';
> > > crmForm.all.new_parentsupplierid_d.style.position = 'absolute';
> > > break;
> > > 
> > > This script was unsuccessful and I would ideally prefer not to create the 
> > > custom field named 'Contact Type'.
> > > 
> > > Thanks very much
> > > 
> > > 
0
Niths (71)
4/9/2008 8:41:01 AM
Hi Niths

Thanks again for your reply. I tested the following script:

var lkupval1 = crmForm.all.new_parentsupplierid.DataValue;

if (lkupval1[0] != null)
{
crmForm.all.parentcustomerid_c.style.display = 'none';
crmForm.all.parentcustomerid_d.style.display = 'none';
crmForm.all.new_parentbusinesspartnerid.style.display = 'none';
crmForm.all.new_parentbusinesspartnerid.style.display = 'none';
}

var lkupval1 = crmForm.all.new_parentbusinesspartnerid.DataValue;

if (lkupval1[0] != null)
{
crmForm.all.parentcustomerid_c.style.display = 'none';
crmForm.all.parentcustomerid_d.style.display = 'none';
crmForm.all.new_parentsupplierid.style.display = 'none';
crmForm.all.new_parentsupplierid.style.display = 'none';
}

var lkupval1 = crmForm.all.parentcustomerid.DataValue;

if (lkupval1[0] != null)
{
crmForm.all.new_parentsupplierid.style.display = 'none';
crmForm.all.new_parentsupplierid.style.display = 'none';
crmForm.all.new_parentbusinesspartnerid.style.display = 'none';
crmForm.all.new_parentbusinesspartnerid.style.display = 'none';
}

I received an error message stating that '0' or is null or not an object. 
Any ideas why this occurring? 

Thanks so much for your help.

Regards
Mark

"Niths" wrote:

> Hi Mark,
> 
> Try this:
> 
> var lkupval1 = crmForm.all.new_parentsupplierid.DataValue;
> 
> if (lkupval1[0] != null) 
> {
>     crmForm.all.new_parentbusinesspartnerid_c.style.display="none";
>     crmForm.all.new_parentbusinesspartnerid_d.style.display="none";
>     crmForm.all.new_parentcustomerid_c.style.display="none";
>     crmForm.all.new_parentcustomerid_d.style.display="none";
> }
> 
> and likewise for the parentbusinesspartnerid and parentcustomerid fields.
> 
> HTH,
> Niths
> 
> "Mark Braithwaite" wrote:
> 
> > Hi Niths
> > 
> > Thanks for your reply. Okay so the begining of part of my script would be 
> > if 
> > crmForm.all.new_parentsupplierid.nextSibling.InnerText II
> > crmForm.all.new_parentbusinesspartnerid.nextSibling.InnerText II
> > crmForm.all.parentcustomerid.nextSibling.InnerText != null 
> > then ........
> > 
> > My question is how do I hide only the fields that are null if one of them is 
> > populated. To be honest I may be lacking the skills to write the Jscript 
> > required. Appreciate your assistance.
> > 
> > Thanks again
> > Mark
> > 
> > "Niths" wrote:
> > 
> > > Hi Mark,
> > > 
> > > How about using If..then constructs to check if a value is present in one of 
> > > the three lookup fields?
> > > 
> > > To get the value in a lookup, you would need to use:
> > > crmForm.all.lookupfield.nextSibling.InnerText
> > > 
> > > Do write in if you have problems using this script.
> > > 
> > > HTH,
> > > Niths
> > > 
> > > "Mark Braithwaite" wrote:
> > > 
> > > > 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. 
> > > > 
> > > > If I use the On Save event, the question is, how do I hide the remaining 
> > > > fields if a certain value is selected in one of the fields? I only want to 
> > > > hide the fields that are not populated. 
> > > > 
> > > > I suppose I could use a script which if all fields are null then do nothing 
> > > > however if one of the fields are populated then hide the fields that are 
> > > > null. How would you translate this into Jscript? 
> > > > 
> > > > I created a custom field named 'Contact Type' and tested the following script:
> > > > 
> > > > var type = crmForm.all.new_contacttype.SelectedText;
> > > > switch (type)
> > > > { 
> > > > case "Business Partner
> > > > crmForm.all.parentcustomerid.style.visibility = 'hidden';
> > > > crmForm.all.parentcustomerid.style.position = 'absolute';
> > > > crmForm.all.parentcustomerid_c.style.visibility = 'hidden';
> > > > crmForm.all.parentcustomerid_c.style.position = 'absolute';
> > > > crmForm.all.parentcustomerid_d.style.visibility = 'hidden';
> > > > crmForm.all.parentcustomerid_d.style.position = 'absolute';
> > > > crmForm.all.new_parentbusinesspartnerid.style.visibility = 'visible';
> > > > crmForm.all.new_parentbusinesspartnerid.style.position = 'relative';
> > > > crmForm.all.new_parentbusinesspartnerid_c.style.visibility = 'visible';
> > > > crmForm.all.new_parentbusinesspartnerid_c.style.position = 'relative';
> > > > crmForm.all.new_parentbusinesspartnerid_d.style.visibility = 'visible';
> > > > crmForm.all.new_parentbusinesspartnerid_d.style.position = 'relative'; 
> > > > crmForm.all.new_parentsupplierid.style.visibility = 'hidden';
> > > > crmForm.all.new_parentsupplierid.style.position = 'absolute';
> > > > crmForm.all.new_parentsupplierid_c.style.visibility = 'hidden';
> > > > crmForm.all.new_parentsupplierid_c.style.position = 'absolute';
> > > > crmForm.all.new_parentsupplierid_d.style.visibility = 'hidden';
> > > > crmForm.all.new_parentsupplierid_d.style.position = 'absolute'; 
> > > > 
> > > > case "Supplier"
> > > > crmForm.all.parentcustomerid.style.visibility = 'hidden';
> > > > crmForm.all.parentcustomerid.style.position = 'absolute';
> > > > crmForm.all.parentcustomerid_c.style.visibility = 'hidden';
> > > > crmForm.all.parentcustomerid_c.style.position = 'absolute';
> > > > crmForm.all.parentcustomerid_d.style.visibility = 'hidden';
> > > > crmForm.all.parentcustomerid_d.style.position = 'absolute';
> > > > crmForm.all.new_parentbusinesspartnerid.style.visibility = 'hidden';
> > > > crmForm.all.new_parentbusinesspartnerid.style.position = 'absolute';
> > > > crmForm.all.new_parentbusinesspartnerid_c.style.visibility = 'hidden';
> > > > crmForm.all.new_parentbusinesspartnerid_c.style.position = 'absolute';
> > > > crmForm.all.new_parentbusinesspartnerid_d.style.visibility = 'hidden';
> > > > crmForm.all.new_parentbusinesspartnerid_d.style.position = 'absolute'; 
> > > > crmForm.all.new_parentsupplierid.style.visibility = 'visible';
> > > > crmForm.all.new_parentsupplierid.style.position = 'relative';
> > > > crmForm.all.new_parentsupplierid_c.style.visibility = 'visible';
> > > > crmForm.all.new_parentsupplierid_c.style.position = 'relative';
> > > > crmForm.all.new_parentsupplierid_d.style.visibility = 'visible;
> > > > crmForm.all.new_parentsupplierid_d.style.position = 'relative';
> > > > break;
> > > > 
> > > > case "Customer"
> > > > crmForm.all.parentcustomerid.style.visibility = 'visible';
> > > > crmForm.all.parentcustomerid.style.position = 'relative';
> > > > crmForm.all.parentcustomerid_c.style.visibility = 'visible';
> > > > crmForm.all.parentcustomerid_c.style.position = 'relative';
> > > > crmForm.all.parentcustomerid_d.style.visibility = 'visible';
> > > > crmForm.all.parentcustomerid_d.style.position = 'relative';
> > > > crmForm.all.new_parentbusinesspartnerid.style.visibility = 'hidden';
> > > > crmForm.all.new_parentbusinesspartnerid.style.position = 'absolute';
> > > > crmForm.all.new_parentbusinesspartnerid_c.style.visibility = 'hidden';
> > > > crmForm.all.new_parentbusinesspartnerid_c.style.position = 'absolute';
> > > > crmForm.all.new_parentbusinesspartnerid_d.style.visibility = 'hidden';
> > > > crmForm.all.new_parentbusinesspartnerid_d.style.position = 'absolute'; 
> > > > crmForm.all.new_parentsupplierid.style.visibility = 'hidden';
> > > > crmForm.all.new_parentsupplierid.style.position = 'absolute';
> > > > crmForm.all.new_parentsupplierid_c.style.visibility = 'hidden';
> > > > crmForm.all.new_parentsupplierid_c.style.position = 'absolute';
> > > > crmForm.all.new_parentsupplierid_d.style.visibility = 'hidden';
> > > > crmForm.all.new_parentsupplierid_d.style.position = 'absolute';
> > > > break;
> > > > 
> > > > This script was unsuccessful and I would ideally prefer not to create the 
> > > > custom field named 'Contact Type'.
> > > > 
> > > > Thanks very much
> > > > 
> > > > 
0
4/9/2008 9:37:00 AM
Hi Niths

Thanks again for your reply. I tested the following script:

var lkupval1 = crmForm.all.new_parentsupplierid.DataValue;

if (lkupval1[0] != null)
{
crmForm.all.parentcustomerid_c.style.display = 'none';
crmForm.all.parentcustomerid_d.style.display = 'none';
crmForm.all.new_parentbusinesspartnerid.style.display = 'none';
crmForm.all.new_parentbusinesspartnerid.style.display = 'none';
}

var lkupval1 = crmForm.all.new_parentbusinesspartnerid.DataValue;

if (lkupval1[0] != null)
{
crmForm.all.parentcustomerid_c.style.display = 'none';
crmForm.all.parentcustomerid_d.style.display = 'none';
crmForm.all.new_parentsupplierid.style.display = 'none';
crmForm.all.new_parentsupplierid.style.display = 'none';
}

var lkupval1 = crmForm.all.parentcustomerid.DataValue;

if (lkupval1[0] != null)
{
crmForm.all.new_parentsupplierid.style.display = 'none';
crmForm.all.new_parentsupplierid.style.display = 'none';
crmForm.all.new_parentbusinesspartnerid.style.display = 'none';
crmForm.all.new_parentbusinesspartnerid.style.display = 'none';
}

I received an error message stating that '0' or is null or not an object. 
Any ideas why this occurring? 

Thanks so much for your help.

Regards
Mark

"Niths" wrote:

> Hi Mark,
> 
> Try this:
> 
> var lkupval1 = crmForm.all.new_parentsupplierid.DataValue;
> 
> if (lkupval1[0] != null) 
> {
>     crmForm.all.new_parentbusinesspartnerid_c.style.display="none";
>     crmForm.all.new_parentbusinesspartnerid_d.style.display="none";
>     crmForm.all.new_parentcustomerid_c.style.display="none";
>     crmForm.all.new_parentcustomerid_d.style.display="none";
> }
> 
> and likewise for the parentbusinesspartnerid and parentcustomerid fields.
> 
> HTH,
> Niths
> 
> "Mark Braithwaite" wrote:
> 
> > Hi Niths
> > 
> > Thanks for your reply. Okay so the begining of part of my script would be 
> > if 
> > crmForm.all.new_parentsupplierid.nextSibling.InnerText II
> > crmForm.all.new_parentbusinesspartnerid.nextSibling.InnerText II
> > crmForm.all.parentcustomerid.nextSibling.InnerText != null 
> > then ........
> > 
> > My question is how do I hide only the fields that are null if one of them is 
> > populated. To be honest I may be lacking the skills to write the Jscript 
> > required. Appreciate your assistance.
> > 
> > Thanks again
> > Mark
> > 
> > "Niths" wrote:
> > 
> > > Hi Mark,
> > > 
> > > How about using If..then constructs to check if a value is present in one of 
> > > the three lookup fields?
> > > 
> > > To get the value in a lookup, you would need to use:
> > > crmForm.all.lookupfield.nextSibling.InnerText
> > > 
> > > Do write in if you have problems using this script.
> > > 
> > > HTH,
> > > Niths
> > > 
> > > "Mark Braithwaite" wrote:
> > > 
> > > > 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. 
> > > > 
> > > > If I use the On Save event, the question is, how do I hide the remaining 
> > > > fields if a certain value is selected in one of the fields? I only want to 
> > > > hide the fields that are not populated. 
> > > > 
> > > > I suppose I could use a script which if all fields are null then do nothing 
> > > > however if one of the fields are populated then hide the fields that are 
> > > > null. How would you translate this into Jscript? 
> > > > 
> > > > I created a custom field named 'Contact Type' and tested the following script:
> > > > 
> > > > var type = crmForm.all.new_contacttype.SelectedText;
> > > > switch (type)
> > > > { 
> > > > case "Business Partner
> > > > crmForm.all.parentcustomerid.style.visibility = 'hidden';
> > > > crmForm.all.parentcustomerid.style.position = 'absolute';
> > > > crmForm.all.parentcustomerid_c.style.visibility = 'hidden';
> > > > crmForm.all.parentcustomerid_c.style.position = 'absolute';
> > > > crmForm.all.parentcustomerid_d.style.visibility = 'hidden';
> > > > crmForm.all.parentcustomerid_d.style.position = 'absolute';
> > > > crmForm.all.new_parentbusinesspartnerid.style.visibility = 'visible';
> > > > crmForm.all.new_parentbusinesspartnerid.style.position = 'relative';
> > > > crmForm.all.new_parentbusinesspartnerid_c.style.visibility = 'visible';
> > > > crmForm.all.new_parentbusinesspartnerid_c.style.position = 'relative';
> > > > crmForm.all.new_parentbusinesspartnerid_d.style.visibility = 'visible';
> > > > crmForm.all.new_parentbusinesspartnerid_d.style.position = 'relative'; 
> > > > crmForm.all.new_parentsupplierid.style.visibility = 'hidden';
> > > > crmForm.all.new_parentsupplierid.style.position = 'absolute';
> > > > crmForm.all.new_parentsupplierid_c.style.visibility = 'hidden';
> > > > crmForm.all.new_parentsupplierid_c.style.position = 'absolute';
> > > > crmForm.all.new_parentsupplierid_d.style.visibility = 'hidden';
> > > > crmForm.all.new_parentsupplierid_d.style.position = 'absolute'; 
> > > > 
> > > > case "Supplier"
> > > > crmForm.all.parentcustomerid.style.visibility = 'hidden';
> > > > crmForm.all.parentcustomerid.style.position = 'absolute';
> > > > crmForm.all.parentcustomerid_c.style.visibility = 'hidden';
> > > > crmForm.all.parentcustomerid_c.style.position = 'absolute';
> > > > crmForm.all.parentcustomerid_d.style.visibility = 'hidden';
> > > > crmForm.all.parentcustomerid_d.style.position = 'absolute';
> > > > crmForm.all.new_parentbusinesspartnerid.style.visibility = 'hidden';
> > > > crmForm.all.new_parentbusinesspartnerid.style.position = 'absolute';
> > > > crmForm.all.new_parentbusinesspartnerid_c.style.visibility = 'hidden';
> > > > crmForm.all.new_parentbusinesspartnerid_c.style.position = 'absolute';
> > > > crmForm.all.new_parentbusinesspartnerid_d.style.visibility = 'hidden';
> > > > crmForm.all.new_parentbusinesspartnerid_d.style.position = 'absolute'; 
> > > > crmForm.all.new_parentsupplierid.style.visibility = 'visible';
> > > > crmForm.all.new_parentsupplierid.style.position = 'relative';
> > > > crmForm.all.new_parentsupplierid_c.style.visibility = 'visible';
> > > > crmForm.all.new_parentsupplierid_c.style.position = 'relative';
> > > > crmForm.all.new_parentsupplierid_d.style.visibility = 'visible;
> > > > crmForm.all.new_parentsupplierid_d.style.position = 'relative';
> > > > break;
> > > > 
> > > > case "Customer"
> > > > crmForm.all.parentcustomerid.style.visibility = 'visible';
> > > > crmForm.all.parentcustomerid.style.position = 'relative';
> > > > crmForm.all.parentcustomerid_c.style.visibility = 'visible';
> > > > crmForm.all.parentcustomerid_c.style.position = 'relative';
> > > > crmForm.all.parentcustomerid_d.style.visibility = 'visible';
> > > > crmForm.all.parentcustomerid_d.style.position = 'relative';
> > > > crmForm.all.new_parentbusinesspartnerid.style.visibility = 'hidden';
> > > > crmForm.all.new_parentbusinesspartnerid.style.position = 'absolute';
> > > > crmForm.all.new_parentbusinesspartnerid_c.style.visibility = 'hidden';
> > > > crmForm.all.new_parentbusinesspartnerid_c.style.position = 'absolute';
> > > > crmForm.all.new_parentbusinesspartnerid_d.style.visibility = 'hidden';
> > > > crmForm.all.new_parentbusinesspartnerid_d.style.position = 'absolute'; 
> > > > crmForm.all.new_parentsupplierid.style.visibility = 'hidden';
> > > > crmForm.all.new_parentsupplierid.style.position = 'absolute';
> > > > crmForm.all.new_parentsupplierid_c.style.visibility = 'hidden';
> > > > crmForm.all.new_parentsupplierid_c.style.position = 'absolute';
> > > > crmForm.all.new_parentsupplierid_d.style.visibility = 'hidden';
> > > > crmForm.all.new_parentsupplierid_d.style.position = 'absolute';
> > > > break;
> > > > 
> > > > This script was unsuccessful and I would ideally prefer not to create the 
> > > > custom field named 'Contact Type'.
> > > > 
> > > > Thanks very much
> > > > 
> > > > 
0
4/9/2008 9:37:00 AM
Hi Mark,

Where did you put this script? Did you put in the onChange event of the 
lookups?

HTH,
Niths

"Mark Braithwaite" wrote:

> Hi Niths
> 
> Thanks again for your reply. I tested the following script:
> 
> var lkupval1 = crmForm.all.new_parentsupplierid.DataValue;
> 
> if (lkupval1[0] != null)
> {
> crmForm.all.parentcustomerid_c.style.display = 'none';
> crmForm.all.parentcustomerid_d.style.display = 'none';
> crmForm.all.new_parentbusinesspartnerid.style.display = 'none';
> crmForm.all.new_parentbusinesspartnerid.style.display = 'none';
> }
> 
> var lkupval1 = crmForm.all.new_parentbusinesspartnerid.DataValue;
> 
> if (lkupval1[0] != null)
> {
> crmForm.all.parentcustomerid_c.style.display = 'none';
> crmForm.all.parentcustomerid_d.style.display = 'none';
> crmForm.all.new_parentsupplierid.style.display = 'none';
> crmForm.all.new_parentsupplierid.style.display = 'none';
> }
> 
> var lkupval1 = crmForm.all.parentcustomerid.DataValue;
> 
> if (lkupval1[0] != null)
> {
> crmForm.all.new_parentsupplierid.style.display = 'none';
> crmForm.all.new_parentsupplierid.style.display = 'none';
> crmForm.all.new_parentbusinesspartnerid.style.display = 'none';
> crmForm.all.new_parentbusinesspartnerid.style.display = 'none';
> }
> 
> I received an error message stating that '0' or is null or not an object. 
> Any ideas why this occurring? 
> 
> Thanks so much for your help.
> 
> Regards
> Mark
> 
> "Niths" wrote:
> 
> > Hi Mark,
> > 
> > Try this:
> > 
> > var lkupval1 = crmForm.all.new_parentsupplierid.DataValue;
> > 
> > if (lkupval1[0] != null) 
> > {
> >     crmForm.all.new_parentbusinesspartnerid_c.style.display="none";
> >     crmForm.all.new_parentbusinesspartnerid_d.style.display="none";
> >     crmForm.all.new_parentcustomerid_c.style.display="none";
> >     crmForm.all.new_parentcustomerid_d.style.display="none";
> > }
> > 
> > and likewise for the parentbusinesspartnerid and parentcustomerid fields.
> > 
> > HTH,
> > Niths
> > 
> > "Mark Braithwaite" wrote:
> > 
> > > Hi Niths
> > > 
> > > Thanks for your reply. Okay so the begining of part of my script would be 
> > > if 
> > > crmForm.all.new_parentsupplierid.nextSibling.InnerText II
> > > crmForm.all.new_parentbusinesspartnerid.nextSibling.InnerText II
> > > crmForm.all.parentcustomerid.nextSibling.InnerText != null 
> > > then ........
> > > 
> > > My question is how do I hide only the fields that are null if one of them is 
> > > populated. To be honest I may be lacking the skills to write the Jscript 
> > > required. Appreciate your assistance.
> > > 
> > > Thanks again
> > > Mark
> > > 
> > > "Niths" wrote:
> > > 
> > > > Hi Mark,
> > > > 
> > > > How about using If..then constructs to check if a value is present in one of 
> > > > the three lookup fields?
> > > > 
> > > > To get the value in a lookup, you would need to use:
> > > > crmForm.all.lookupfield.nextSibling.InnerText
> > > > 
> > > > Do write in if you have problems using this script.
> > > > 
> > > > HTH,
> > > > Niths
> > > > 
> > > > "Mark Braithwaite" wrote:
> > > > 
> > > > > 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. 
> > > > > 
> > > > > If I use the On Save event, the question is, how do I hide the remaining 
> > > > > fields if a certain value is selected in one of the fields? I only want to 
> > > > > hide the fields that are not populated. 
> > > > > 
> > > > > I suppose I could use a script which if all fields are null then do nothing 
> > > > > however if one of the fields are populated then hide the fields that are 
> > > > > null. How would you translate this into Jscript? 
> > > > > 
> > > > > I created a custom field named 'Contact Type' and tested the following script:
> > > > > 
> > > > > var type = crmForm.all.new_contacttype.SelectedText;
> > > > > switch (type)
> > > > > { 
> > > > > case "Business Partner
> > > > > crmForm.all.parentcustomerid.style.visibility = 'hidden';
> > > > > crmForm.all.parentcustomerid.style.position = 'absolute';
> > > > > crmForm.all.parentcustomerid_c.style.visibility = 'hidden';
> > > > > crmForm.all.parentcustomerid_c.style.position = 'absolute';
> > > > > crmForm.all.parentcustomerid_d.style.visibility = 'hidden';
> > > > > crmForm.all.parentcustomerid_d.style.position = 'absolute';
> > > > > crmForm.all.new_parentbusinesspartnerid.style.visibility = 'visible';
> > > > > crmForm.all.new_parentbusinesspartnerid.style.position = 'relative';
> > > > > crmForm.all.new_parentbusinesspartnerid_c.style.visibility = 'visible';
> > > > > crmForm.all.new_parentbusinesspartnerid_c.style.position = 'relative';
> > > > > crmForm.all.new_parentbusinesspartnerid_d.style.visibility = 'visible';
> > > > > crmForm.all.new_parentbusinesspartnerid_d.style.position = 'relative'; 
> > > > > crmForm.all.new_parentsupplierid.style.visibility = 'hidden';
> > > > > crmForm.all.new_parentsupplierid.style.position = 'absolute';
> > > > > crmForm.all.new_parentsupplierid_c.style.visibility = 'hidden';
> > > > > crmForm.all.new_parentsupplierid_c.style.position = 'absolute';
> > > > > crmForm.all.new_parentsupplierid_d.style.visibility = 'hidden';
> > > > > crmForm.all.new_parentsupplierid_d.style.position = 'absolute'; 
> > > > > 
> > > > > case "Supplier"
> > > > > crmForm.all.parentcustomerid.style.visibility = 'hidden';
> > > > > crmForm.all.parentcustomerid.style.position = 'absolute';
> > > > > crmForm.all.parentcustomerid_c.style.visibility = 'hidden';
> > > > > crmForm.all.parentcustomerid_c.style.position = 'absolute';
> > > > > crmForm.all.parentcustomerid_d.style.visibility = 'hidden';
> > > > > crmForm.all.parentcustomerid_d.style.position = 'absolute';
> > > > > crmForm.all.new_parentbusinesspartnerid.style.visibility = 'hidden';
> > > > > crmForm.all.new_parentbusinesspartnerid.style.position = 'absolute';
> > > > > crmForm.all.new_parentbusinesspartnerid_c.style.visibility = 'hidden';
> > > > > crmForm.all.new_parentbusinesspartnerid_c.style.position = 'absolute';
> > > > > crmForm.all.new_parentbusinesspartnerid_d.style.visibility = 'hidden';
> > > > > crmForm.all.new_parentbusinesspartnerid_d.style.position = 'absolute'; 
> > > > > crmForm.all.new_parentsupplierid.style.visibility = 'visible';
> > > > > crmForm.all.new_parentsupplierid.style.position = 'relative';
> > > > > crmForm.all.new_parentsupplierid_c.style.visibility = 'visible';
> > > > > crmForm.all.new_parentsupplierid_c.style.position = 'relative';
> > > > > crmForm.all.new_parentsupplierid_d.style.visibility = 'visible;
> > > > > crmForm.all.new_parentsupplierid_d.style.position = 'relative';
> > > > > break;
> > > > > 
> > > > > case "Customer"
> > > > > crmForm.all.parentcustomerid.style.visibility = 'visible';
> > > > > crmForm.all.parentcustomerid.style.position = 'relative';
> > > > > crmForm.all.parentcustomerid_c.style.visibility = 'visible';
> > > > > crmForm.all.parentcustomerid_c.style.position = 'relative';
> > > > > crmForm.all.parentcustomerid_d.style.visibility = 'visible';
> > > > > crmForm.all.parentcustomerid_d.style.position = 'relative';
> > > > > crmForm.all.new_parentbusinesspartnerid.style.visibility = 'hidden';
> > > > > crmForm.all.new_parentbusinesspartnerid.style.position = 'absolute';
> > > > > crmForm.all.new_parentbusinesspartnerid_c.style.visibility = 'hidden';
> > > > > crmForm.all.new_parentbusinesspartnerid_c.style.position = 'absolute';
> > > > > crmForm.all.new_parentbusinesspartnerid_d.style.visibility = 'hidden';
> > > > > crmForm.all.new_parentbusinesspartnerid_d.style.position = 'absolute'; 
> > > > > crmForm.all.new_parentsupplierid.style.visibility = 'hidden';
> > > > > crmForm.all.new_parentsupplierid.style.position = 'absolute';
> > > > > crmForm.all.new_parentsupplierid_c.style.visibility = 'hidden';
> > > > > crmForm.all.new_parentsupplierid_c.style.position = 'absolute';
> > > > > crmForm.all.new_parentsupplierid_d.style.visibility = 'hidden';
> > > > > crmForm.all.new_parentsupplierid_d.style.position = 'absolute';
> > > > > break;
> > > > > 
> > > > > This script was unsuccessful and I would ideally prefer not to create the 
> > > > > custom field named 'Contact Type'.
> > > > > 
> > > > > Thanks very much
> > > > > 
> > > > > 
0
Niths (71)
4/9/2008 10:43:00 AM
Hi Niths

I am using the OnSave event and my final script looks like this:

var lkupval1 = crmForm.all.new_parentsupplierid.DataValue;

if (lkupval1 != null)
{
crmForm.all.parentcustomerid.style.visibility = 'hidden';
crmForm.all.parentcustomerid.style.position = 'absolute';
crmForm.all.parentcustomerid_c.style.visibility = 'hidden';
crmForm.all.parentcustomerid_c.style.position = 'absolute';
crmForm.all.parentcustomerid_d.style.visibility = 'hidden';
crmForm.all.parentcustomerid_d.style.position = 'absolute';
crmForm.all.new_parentbusinesspartnerid.style.visibility = 'hidden';
crmForm.all.new_parentbusinesspartnerid.style.position = 'absolute';
crmForm.all.new_parentbusinesspartnerid_c.style.visibility = 'hidden';
crmForm.all.new_parentbusinesspartnerid_c.style.position = 'absolute';
crmForm.all.new_parentbusinesspartnerid_d.style.visibility = 'hidden';
crmForm.all.new_parentbusinesspartnerid_d.style.position = 'absolute';
}
crmForm.all.new_parentsupplierid.ForceSubmit = true;

var lkupval2 = crmForm.all.new_parentbusinesspartnerid.DataValue;

if (lkupval2 != null)
{
crmForm.all.parentcustomerid.style.visibility = 'hidden';
crmForm.all.parentcustomerid.style.position = 'absolute';
crmForm.all.parentcustomerid_c.style.visibility = 'hidden';
crmForm.all.parentcustomerid_c.style.position = 'absolute';
crmForm.all.parentcustomerid_d.style.visibility = 'hidden';
crmForm.all.parentcustomerid_d.style.position = 'absolute';
crmForm.all.new_parentsupplierid.style.visibility = 'hidden';
crmForm.all.new_parentsupplierid.style.position = 'absolute';
crmForm.all.new_parentsupplierid_c.style.visibility = 'hidden';
crmForm.all.new_parentsupplierid_c.style.position = 'absolute';
crmForm.all.new_parentsupplierid_d.style.visibility = 'hidden';
crmForm.all.new_parentsupplierid_d.style.position = 'absolute';
}
crmForm.all.new_parentbusinesspartnerid.ForceSubmit = true;

var lkupval3 = crmForm.all.parentcustomerid.DataValue;

if (lkupval3 != null)
{
crmForm.all.new_parentbusinesspartnerid.style.visibility = 'hidden';
crmForm.all.new_parentbusinesspartnerid.style.position = 'absolute';
crmForm.all.new_parentbusinesspartnerid_c.style.visibility = 'hidden';
crmForm.all.new_parentbusinesspartnerid_c.style.position = 'absolute';
crmForm.all.new_parentbusinesspartnerid_d.style.visibility = 'hidden';
crmForm.all.new_parentbusinesspartnerid_d.style.position = 'absolute';
crmForm.all.new_parentsupplierid.style.visibility = 'hidden';
crmForm.all.new_parentsupplierid.style.position = 'absolute';
crmForm.all.new_parentsupplierid_c.style.visibility = 'hidden';
crmForm.all.new_parentsupplierid_c.style.position = 'absolute';
crmForm.all.new_parentsupplierid_d.style.visibility = 'hidden';
crmForm.all.new_parentsupplierid_d.style.position = 'absolute'
}
crmForm.all.parentcustomerid.ForceSubmit = true;

Everything works perfectly except for one small glitch. If I 'Save', the 
fields that are null disappear however if I 'Save and Close' and reopen the 
form the fields that are null reappear. I am trying to use the ForceSubmit = 
true however this does not seem to be working.

Would you assist me with this last bit?

Thanks again for all your help.
Mark

"Niths" wrote:

> Hi Mark,
> 
> Where did you put this script? Did you put in the onChange event of the 
> lookups?
> 
> HTH,
> Niths
> 
> "Mark Braithwaite" wrote:
> 
> > Hi Niths
> > 
> > Thanks again for your reply. I tested the following script:
> > 
> > var lkupval1 = crmForm.all.new_parentsupplierid.DataValue;
> > 
> > if (lkupval1[0] != null)
> > {
> > crmForm.all.parentcustomerid_c.style.display = 'none';
> > crmForm.all.parentcustomerid_d.style.display = 'none';
> > crmForm.all.new_parentbusinesspartnerid.style.display = 'none';
> > crmForm.all.new_parentbusinesspartnerid.style.display = 'none';
> > }
> > 
> > var lkupval1 = crmForm.all.new_parentbusinesspartnerid.DataValue;
> > 
> > if (lkupval1[0] != null)
> > {
> > crmForm.all.parentcustomerid_c.style.display = 'none';
> > crmForm.all.parentcustomerid_d.style.display = 'none';
> > crmForm.all.new_parentsupplierid.style.display = 'none';
> > crmForm.all.new_parentsupplierid.style.display = 'none';
> > }
> > 
> > var lkupval1 = crmForm.all.parentcustomerid.DataValue;
> > 
> > if (lkupval1[0] != null)
> > {
> > crmForm.all.new_parentsupplierid.style.display = 'none';
> > crmForm.all.new_parentsupplierid.style.display = 'none';
> > crmForm.all.new_parentbusinesspartnerid.style.display = 'none';
> > crmForm.all.new_parentbusinesspartnerid.style.display = 'none';
> > }
> > 
> > I received an error message stating that '0' or is null or not an object. 
> > Any ideas why this occurring? 
> > 
> > Thanks so much for your help.
> > 
> > Regards
> > Mark
> > 
> > "Niths" wrote:
> > 
> > > Hi Mark,
> > > 
> > > Try this:
> > > 
> > > var lkupval1 = crmForm.all.new_parentsupplierid.DataValue;
> > > 
> > > if (lkupval1[0] != null) 
> > > {
> > >     crmForm.all.new_parentbusinesspartnerid_c.style.display="none";
> > >     crmForm.all.new_parentbusinesspartnerid_d.style.display="none";
> > >     crmForm.all.new_parentcustomerid_c.style.display="none";
> > >     crmForm.all.new_parentcustomerid_d.style.display="none";
> > > }
> > > 
> > > and likewise for the parentbusinesspartnerid and parentcustomerid fields.
> > > 
> > > HTH,
> > > Niths
> > > 
> > > "Mark Braithwaite" wrote:
> > > 
> > > > Hi Niths
> > > > 
> > > > Thanks for your reply. Okay so the begining of part of my script would be 
> > > > if 
> > > > crmForm.all.new_parentsupplierid.nextSibling.InnerText II
> > > > crmForm.all.new_parentbusinesspartnerid.nextSibling.InnerText II
> > > > crmForm.all.parentcustomerid.nextSibling.InnerText != null 
> > > > then ........
> > > > 
> > > > My question is how do I hide only the fields that are null if one of them is 
> > > > populated. To be honest I may be lacking the skills to write the Jscript 
> > > > required. Appreciate your assistance.
> > > > 
> > > > Thanks again
> > > > Mark
> > > > 
> > > > "Niths" wrote:
> > > > 
> > > > > Hi Mark,
> > > > > 
> > > > > How about using If..then constructs to check if a value is present in one of 
> > > > > the three lookup fields?
> > > > > 
> > > > > To get the value in a lookup, you would need to use:
> > > > > crmForm.all.lookupfield.nextSibling.InnerText
> > > > > 
> > > > > Do write in if you have problems using this script.
> > > > > 
> > > > > HTH,
> > > > > Niths
> > > > > 
> > > > > "Mark Braithwaite" wrote:
> > > > > 
> > > > > > 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. 
> > > > > > 
> > > > > > If I use the On Save event, the question is, how do I hide the remaining 
> > > > > > fields if a certain value is selected in one of the fields? I only want to 
> > > > > > hide the fields that are not populated. 
> > > > > > 
> > > > > > I suppose I could use a script which if all fields are null then do nothing 
> > > > > > however if one of the fields are populated then hide the fields that are 
> > > > > > null. How would you translate this into Jscript? 
> > > > > > 
> > > > > > I created a custom field named 'Contact Type' and tested the following script:
> > > > > > 
> > > > > > var type = crmForm.all.new_contacttype.SelectedText;
> > > > > > switch (type)
> > > > > > { 
> > > > > > case "Business Partner
> > > > > > crmForm.all.parentcustomerid.style.visibility = 'hidden';
> > > > > > crmForm.all.parentcustomerid.style.position = 'absolute';
> > > > > > crmForm.all.parentcustomerid_c.style.visibility = 'hidden';
> > > > > > crmForm.all.parentcustomerid_c.style.position = 'absolute';
> > > > > > crmForm.all.parentcustomerid_d.style.visibility = 'hidden';
> > > > > > crmForm.all.parentcustomerid_d.style.position = 'absolute';
> > > > > > crmForm.all.new_parentbusinesspartnerid.style.visibility = 'visible';
> > > > > > crmForm.all.new_parentbusinesspartnerid.style.position = 'relative';
> > > > > > crmForm.all.new_parentbusinesspartnerid_c.style.visibility = 'visible';
> > > > > > crmForm.all.new_parentbusinesspartnerid_c.style.position = 'relative';
> > > > > > crmForm.all.new_parentbusinesspartnerid_d.style.visibility = 'visible';
> > > > > > crmForm.all.new_parentbusinesspartnerid_d.style.position = 'relative'; 
> > > > > > crmForm.all.new_parentsupplierid.style.visibility = 'hidden';
> > > > > > crmForm.all.new_parentsupplierid.style.position = 'absolute';
> > > > > > crmForm.all.new_parentsupplierid_c.style.visibility = 'hidden';
> > > > > > crmForm.all.new_parentsupplierid_c.style.position = 'absolute';
> > > > > > crmForm.all.new_parentsupplierid_d.style.visibility = 'hidden';
> > > > > > crmForm.all.new_parentsupplierid_d.style.position = 'absolute'; 
> > > > > > 
> > > > > > case "Supplier"
> > > > > > crmForm.all.parentcustomerid.style.visibility = 'hidden';
> > > > > > crmForm.all.parentcustomerid.style.position = 'absolute';
> > > > > > crmForm.all.parentcustomerid_c.style.visibility = 'hidden';
> > > > > > crmForm.all.parentcustomerid_c.style.position = 'absolute';
> > > > > > crmForm.all.parentcustomerid_d.style.visibility = 'hidden';
> > > > > > crmForm.all.parentcustomerid_d.style.position = 'absolute';
> > > > > > crmForm.all.new_parentbusinesspartnerid.style.visibility = 'hidden';
> > > > > > crmForm.all.new_parentbusinesspartnerid.style.position = 'absolute';
> > > > > > crmForm.all.new_parentbusinesspartnerid_c.style.visibility = 'hidden';
> > > > > > crmForm.all.new_parentbusinesspartnerid_c.style.position = 'absolute';
> > > > > > crmForm.all.new_parentbusinesspartnerid_d.style.visibility = 'hidden';
> > > > > > crmForm.all.new_parentbusinesspartnerid_d.style.position = 'absolute'; 
> > > > > > crmForm.all.new_parentsupplierid.style.visibility = 'visible';
> > > > > > crmForm.all.new_parentsupplierid.style.position = 'relative';
> > > > > > crmForm.all.new_parentsupplierid_c.style.visibility = 'visible';
> > > > > > crmForm.all.new_parentsupplierid_c.style.position = 'relative';
> > > > > > crmForm.all.new_parentsupplierid_d.style.visibility = 'visible;
> > > > > > crmForm.all.new_parentsupplierid_d.style.position = 'relative';
> > > > > > break;
> > > > > > 
> > > > > > case "Customer"
> > > > > > crmForm.all.parentcustomerid.style.visibility = 'visible';
> > > > > > crmForm.all.parentcustomerid.style.position = 'relative';
> > > > > > crmForm.all.parentcustomerid_c.style.visibility = 'visible';
> > > > > > crmForm.all.parentcustomerid_c.style.position = 'relative';
> > > > > > crmForm.all.parentcustomerid_d.style.visibility = 'visible';
> > > > > > crmForm.all.parentcustomerid_d.style.position = 'relative';
> > > > > > crmForm.all.new_parentbusinesspartnerid.style.visibility = 'hidden';
> > > > > > crmForm.all.new_parentbusinesspartnerid.style.position = 'absolute';
> > > > > > crmForm.all.new_parentbusinesspartnerid_c.style.visibility = 'hidden';
> > > > > > crmForm.all.new_parentbusinesspartnerid_c.style.position = 'absolute';
> > > > > > crmForm.all.new_parentbusinesspartnerid_d.style.visibility = 'hidden';
> > > > > > crmForm.all.new_parentbusinesspartnerid_d.style.position = 'absolute'; 
> > > > > > crmForm.all.new_parentsupplierid.style.visibility = 'hidden';
> > > > > > crmForm.all.new_parentsupplierid.style.position = 'absolute';
> > > > > > crmForm.all.new_parentsupplierid_c.style.visibility = 'hidden';
> > > > > > crmForm.all.new_parentsupplierid_c.style.position = 'absolute';
> > > > > > crmForm.all.new_parentsupplierid_d.style.visibility = 'hidden';
> > > > > > crmForm.all.new_parentsupplierid_d.style.position = 'absolute';
> > > > > > break;
> > > > > > 
> > > > > > This script was unsuccessful and I would ideally prefer not to create the 
> > > > > > custom field named 'Contact Type'.
> > > > > > 
> > > > > > Thanks very much
> > > > > > 
> > > > > > 
0
4/9/2008 11:43:00 AM
Hi Niths

I am using the OnSave event and my final script looks like this:

var lkupval1 = crmForm.all.new_parentsupplierid.DataValue;

if (lkupval1 != null)
{
crmForm.all.parentcustomerid.style.visibility = 'hidden';
crmForm.all.parentcustomerid.style.position = 'absolute';
crmForm.all.parentcustomerid_c.style.visibility = 'hidden';
crmForm.all.parentcustomerid_c.style.position = 'absolute';
crmForm.all.parentcustomerid_d.style.visibility = 'hidden';
crmForm.all.parentcustomerid_d.style.position = 'absolute';
crmForm.all.new_parentbusinesspartnerid.style.visibility = 'hidden';
crmForm.all.new_parentbusinesspartnerid.style.position = 'absolute';
crmForm.all.new_parentbusinesspartnerid_c.style.visibility = 'hidden';
crmForm.all.new_parentbusinesspartnerid_c.style.position = 'absolute';
crmForm.all.new_parentbusinesspartnerid_d.style.visibility = 'hidden';
crmForm.all.new_parentbusinesspartnerid_d.style.position = 'absolute';
}
crmForm.all.new_parentsupplierid.ForceSubmit = true;

var lkupval2 = crmForm.all.new_parentbusinesspartnerid.DataValue;

if (lkupval2 != null)
{
crmForm.all.parentcustomerid.style.visibility = 'hidden';
crmForm.all.parentcustomerid.style.position = 'absolute';
crmForm.all.parentcustomerid_c.style.visibility = 'hidden';
crmForm.all.parentcustomerid_c.style.position = 'absolute';
crmForm.all.parentcustomerid_d.style.visibility = 'hidden';
crmForm.all.parentcustomerid_d.style.position = 'absolute';
crmForm.all.new_parentsupplierid.style.visibility = 'hidden';
crmForm.all.new_parentsupplierid.style.position = 'absolute';
crmForm.all.new_parentsupplierid_c.style.visibility = 'hidden';
crmForm.all.new_parentsupplierid_c.style.position = 'absolute';
crmForm.all.new_parentsupplierid_d.style.visibility = 'hidden';
crmForm.all.new_parentsupplierid_d.style.position = 'absolute';
}
crmForm.all.new_parentbusinesspartnerid.ForceSubmit = true;

var lkupval3 = crmForm.all.parentcustomerid.DataValue;

if (lkupval3 != null)
{
crmForm.all.new_parentbusinesspartnerid.style.visibility = 'hidden';
crmForm.all.new_parentbusinesspartnerid.style.position = 'absolute';
crmForm.all.new_parentbusinesspartnerid_c.style.visibility = 'hidden';
crmForm.all.new_parentbusinesspartnerid_c.style.position = 'absolute';
crmForm.all.new_parentbusinesspartnerid_d.style.visibility = 'hidden';
crmForm.all.new_parentbusinesspartnerid_d.style.position = 'absolute';
crmForm.all.new_parentsupplierid.style.visibility = 'hidden';
crmForm.all.new_parentsupplierid.style.position = 'absolute';
crmForm.all.new_parentsupplierid_c.style.visibility = 'hidden';
crmForm.all.new_parentsupplierid_c.style.position = 'absolute';
crmForm.all.new_parentsupplierid_d.style.visibility = 'hidden';
crmForm.all.new_parentsupplierid_d.style.position = 'absolute'
}
crmForm.all.parentcustomerid.ForceSubmit = true;

Everything works perfectly except for one small glitch. If I 'Save', the 
fields that are null disappear however if I 'Save and Close' and reopen the 
form the fields that are null reappear. I am trying to use the ForceSubmit = 
true however this does not seem to be working.

Would you assist me with this last bit?

Thanks again for all your help.
Mark

"Niths" wrote:

> Hi Mark,
> 
> Where did you put this script? Did you put in the onChange event of the 
> lookups?
> 
> HTH,
> Niths
> 
> "Mark Braithwaite" wrote:
> 
> > Hi Niths
> > 
> > Thanks again for your reply. I tested the following script:
> > 
> > var lkupval1 = crmForm.all.new_parentsupplierid.DataValue;
> > 
> > if (lkupval1[0] != null)
> > {
> > crmForm.all.parentcustomerid_c.style.display = 'none';
> > crmForm.all.parentcustomerid_d.style.display = 'none';
> > crmForm.all.new_parentbusinesspartnerid.style.display = 'none';
> > crmForm.all.new_parentbusinesspartnerid.style.display = 'none';
> > }
> > 
> > var lkupval1 = crmForm.all.new_parentbusinesspartnerid.DataValue;
> > 
> > if (lkupval1[0] != null)
> > {
> > crmForm.all.parentcustomerid_c.style.display = 'none';
> > crmForm.all.parentcustomerid_d.style.display = 'none';
> > crmForm.all.new_parentsupplierid.style.display = 'none';
> > crmForm.all.new_parentsupplierid.style.display = 'none';
> > }
> > 
> > var lkupval1 = crmForm.all.parentcustomerid.DataValue;
> > 
> > if (lkupval1[0] != null)
> > {
> > crmForm.all.new_parentsupplierid.style.display = 'none';
> > crmForm.all.new_parentsupplierid.style.display = 'none';
> > crmForm.all.new_parentbusinesspartnerid.style.display = 'none';
> > crmForm.all.new_parentbusinesspartnerid.style.display = 'none';
> > }
> > 
> > I received an error message stating that '0' or is null or not an object. 
> > Any ideas why this occurring? 
> > 
> > Thanks so much for your help.
> > 
> > Regards
> > Mark
> > 
> > "Niths" wrote:
> > 
> > > Hi Mark,
> > > 
> > > Try this:
> > > 
> > > var lkupval1 = crmForm.all.new_parentsupplierid.DataValue;
> > > 
> > > if (lkupval1[0] != null) 
> > > {
> > >     crmForm.all.new_parentbusinesspartnerid_c.style.display="none";
> > >     crmForm.all.new_parentbusinesspartnerid_d.style.display="none";
> > >     crmForm.all.new_parentcustomerid_c.style.display="none";
> > >     crmForm.all.new_parentcustomerid_d.style.display="none";
> > > }
> > > 
> > > and likewise for the parentbusinesspartnerid and parentcustomerid fields.
> > > 
> > > HTH,
> > > Niths
> > > 
> > > "Mark Braithwaite" wrote:
> > > 
> > > > Hi Niths
> > > > 
> > > > Thanks for your reply. Okay so the begining of part of my script would be 
> > > > if 
> > > > crmForm.all.new_parentsupplierid.nextSibling.InnerText II
> > > > crmForm.all.new_parentbusinesspartnerid.nextSibling.InnerText II
> > > > crmForm.all.parentcustomerid.nextSibling.InnerText != null 
> > > > then ........
> > > > 
> > > > My question is how do I hide only the fields that are null if one of them is 
> > > > populated. To be honest I may be lacking the skills to write the Jscript 
> > > > required. Appreciate your assistance.
> > > > 
> > > > Thanks again
> > > > Mark
> > > > 
> > > > "Niths" wrote:
> > > > 
> > > > > Hi Mark,
> > > > > 
> > > > > How about using If..then constructs to check if a value is present in one of 
> > > > > the three lookup fields?
> > > > > 
> > > > > To get the value in a lookup, you would need to use:
> > > > > crmForm.all.lookupfield.nextSibling.InnerText
> > > > > 
> > > > > Do write in if you have problems using this script.
> > > > > 
> > > > > HTH,
> > > > > Niths
> > > > > 
> > > > > "Mark Braithwaite" wrote:
> > > > > 
> > > > > > 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. 
> > > > > > 
> > > > > > If I use the On Save event, the question is, how do I hide the remaining 
> > > > > > fields if a certain value is selected in one of the fields? I only want to 
> > > > > > hide the fields that are not populated. 
> > > > > > 
> > > > > > I suppose I could use a script which if all fields are null then do nothing 
> > > > > > however if one of the fields are populated then hide the fields that are 
> > > > > > null. How would you translate this into Jscript? 
> > > > > > 
> > > > > > I created a custom field named 'Contact Type' and tested the following script:
> > > > > > 
> > > > > > var type = crmForm.all.new_contacttype.SelectedText;
> > > > > > switch (type)
> > > > > > { 
> > > > > > case "Business Partner
> > > > > > crmForm.all.parentcustomerid.style.visibility = 'hidden';
> > > > > > crmForm.all.parentcustomerid.style.position = 'absolute';
> > > > > > crmForm.all.parentcustomerid_c.style.visibility = 'hidden';
> > > > > > crmForm.all.parentcustomerid_c.style.position = 'absolute';
> > > > > > crmForm.all.parentcustomerid_d.style.visibility = 'hidden';
> > > > > > crmForm.all.parentcustomerid_d.style.position = 'absolute';
> > > > > > crmForm.all.new_parentbusinesspartnerid.style.visibility = 'visible';
> > > > > > crmForm.all.new_parentbusinesspartnerid.style.position = 'relative';
> > > > > > crmForm.all.new_parentbusinesspartnerid_c.style.visibility = 'visible';
> > > > > > crmForm.all.new_parentbusinesspartnerid_c.style.position = 'relative';
> > > > > > crmForm.all.new_parentbusinesspartnerid_d.style.visibility = 'visible';
> > > > > > crmForm.all.new_parentbusinesspartnerid_d.style.position = 'relative'; 
> > > > > > crmForm.all.new_parentsupplierid.style.visibility = 'hidden';
> > > > > > crmForm.all.new_parentsupplierid.style.position = 'absolute';
> > > > > > crmForm.all.new_parentsupplierid_c.style.visibility = 'hidden';
> > > > > > crmForm.all.new_parentsupplierid_c.style.position = 'absolute';
> > > > > > crmForm.all.new_parentsupplierid_d.style.visibility = 'hidden';
> > > > > > crmForm.all.new_parentsupplierid_d.style.position = 'absolute'; 
> > > > > > 
> > > > > > case "Supplier"
> > > > > > crmForm.all.parentcustomerid.style.visibility = 'hidden';
> > > > > > crmForm.all.parentcustomerid.style.position = 'absolute';
> > > > > > crmForm.all.parentcustomerid_c.style.visibility = 'hidden';
> > > > > > crmForm.all.parentcustomerid_c.style.position = 'absolute';
> > > > > > crmForm.all.parentcustomerid_d.style.visibility = 'hidden';
> > > > > > crmForm.all.parentcustomerid_d.style.position = 'absolute';
> > > > > > crmForm.all.new_parentbusinesspartnerid.style.visibility = 'hidden';
> > > > > > crmForm.all.new_parentbusinesspartnerid.style.position = 'absolute';
> > > > > > crmForm.all.new_parentbusinesspartnerid_c.style.visibility = 'hidden';
> > > > > > crmForm.all.new_parentbusinesspartnerid_c.style.position = 'absolute';
> > > > > > crmForm.all.new_parentbusinesspartnerid_d.style.visibility = 'hidden';
> > > > > > crmForm.all.new_parentbusinesspartnerid_d.style.position = 'absolute'; 
> > > > > > crmForm.all.new_parentsupplierid.style.visibility = 'visible';
> > > > > > crmForm.all.new_parentsupplierid.style.position = 'relative';
> > > > > > crmForm.all.new_parentsupplierid_c.style.visibility = 'visible';
> > > > > > crmForm.all.new_parentsupplierid_c.style.position = 'relative';
> > > > > > crmForm.all.new_parentsupplierid_d.style.visibility = 'visible;
> > > > > > crmForm.all.new_parentsupplierid_d.style.position = 'relative';
> > > > > > break;
> > > > > > 
> > > > > > case "Customer"
> > > > > > crmForm.all.parentcustomerid.style.visibility = 'visible';
> > > > > > crmForm.all.parentcustomerid.style.position = 'relative';
> > > > > > crmForm.all.parentcustomerid_c.style.visibility = 'visible';
> > > > > > crmForm.all.parentcustomerid_c.style.position = 'relative';
> > > > > > crmForm.all.parentcustomerid_d.style.visibility = 'visible';
> > > > > > crmForm.all.parentcustomerid_d.style.position = 'relative';
> > > > > > crmForm.all.new_parentbusinesspartnerid.style.visibility = 'hidden';
> > > > > > crmForm.all.new_parentbusinesspartnerid.style.position = 'absolute';
> > > > > > crmForm.all.new_parentbusinesspartnerid_c.style.visibility = 'hidden';
> > > > > > crmForm.all.new_parentbusinesspartnerid_c.style.position = 'absolute';
> > > > > > crmForm.all.new_parentbusinesspartnerid_d.style.visibility = 'hidden';
> > > > > > crmForm.all.new_parentbusinesspartnerid_d.style.position = 'absolute'; 
> > > > > > crmForm.all.new_parentsupplierid.style.visibility = 'hidden';
> > > > > > crmForm.all.new_parentsupplierid.style.position = 'absolute';
> > > > > > crmForm.all.new_parentsupplierid_c.style.visibility = 'hidden';
> > > > > > crmForm.all.new_parentsupplierid_c.style.position = 'absolute';
> > > > > > crmForm.all.new_parentsupplierid_d.style.visibility = 'hidden';
> > > > > > crmForm.all.new_parentsupplierid_d.style.position = 'absolute';
> > > > > > break;
> > > > > > 
> > > > > > This script was unsuccessful and I would ideally prefer not to create the 
> > > > > > custom field named 'Contact Type'.
> > > > > > 
> > > > > > Thanks very much
> > > > > > 
> > > > > > 
0
4/9/2008 11:43:00 AM
Great, you got it working!

Well to ensure that the fields stay hidden on form load, put the same script 
you've used in the OnSave event into form onLoad.

HTH,
Niths

"Mark Braithwaite" wrote:

> Hi Niths
> 
> I am using the OnSave event and my final script looks like this:
> 
> var lkupval1 = crmForm.all.new_parentsupplierid.DataValue;
> 
> if (lkupval1 != null)
> {
> crmForm.all.parentcustomerid.style.visibility = 'hidden';
> crmForm.all.parentcustomerid.style.position = 'absolute';
> crmForm.all.parentcustomerid_c.style.visibility = 'hidden';
> crmForm.all.parentcustomerid_c.style.position = 'absolute';
> crmForm.all.parentcustomerid_d.style.visibility = 'hidden';
> crmForm.all.parentcustomerid_d.style.position = 'absolute';
> crmForm.all.new_parentbusinesspartnerid.style.visibility = 'hidden';
> crmForm.all.new_parentbusinesspartnerid.style.position = 'absolute';
> crmForm.all.new_parentbusinesspartnerid_c.style.visibility = 'hidden';
> crmForm.all.new_parentbusinesspartnerid_c.style.position = 'absolute';
> crmForm.all.new_parentbusinesspartnerid_d.style.visibility = 'hidden';
> crmForm.all.new_parentbusinesspartnerid_d.style.position = 'absolute';
> }
> crmForm.all.new_parentsupplierid.ForceSubmit = true;
> 
> var lkupval2 = crmForm.all.new_parentbusinesspartnerid.DataValue;
> 
> if (lkupval2 != null)
> {
> crmForm.all.parentcustomerid.style.visibility = 'hidden';
> crmForm.all.parentcustomerid.style.position = 'absolute';
> crmForm.all.parentcustomerid_c.style.visibility = 'hidden';
> crmForm.all.parentcustomerid_c.style.position = 'absolute';
> crmForm.all.parentcustomerid_d.style.visibility = 'hidden';
> crmForm.all.parentcustomerid_d.style.position = 'absolute';
> crmForm.all.new_parentsupplierid.style.visibility = 'hidden';
> crmForm.all.new_parentsupplierid.style.position = 'absolute';
> crmForm.all.new_parentsupplierid_c.style.visibility = 'hidden';
> crmForm.all.new_parentsupplierid_c.style.position = 'absolute';
> crmForm.all.new_parentsupplierid_d.style.visibility = 'hidden';
> crmForm.all.new_parentsupplierid_d.style.position = 'absolute';
> }
> crmForm.all.new_parentbusinesspartnerid.ForceSubmit = true;
> 
> var lkupval3 = crmForm.all.parentcustomerid.DataValue;
> 
> if (lkupval3 != null)
> {
> crmForm.all.new_parentbusinesspartnerid.style.visibility = 'hidden';
> crmForm.all.new_parentbusinesspartnerid.style.position = 'absolute';
> crmForm.all.new_parentbusinesspartnerid_c.style.visibility = 'hidden';
> crmForm.all.new_parentbusinesspartnerid_c.style.position = 'absolute';
> crmForm.all.new_parentbusinesspartnerid_d.style.visibility = 'hidden';
> crmForm.all.new_parentbusinesspartnerid_d.style.position = 'absolute';
> crmForm.all.new_parentsupplierid.style.visibility = 'hidden';
> crmForm.all.new_parentsupplierid.style.position = 'absolute';
> crmForm.all.new_parentsupplierid_c.style.visibility = 'hidden';
> crmForm.all.new_parentsupplierid_c.style.position = 'absolute';
> crmForm.all.new_parentsupplierid_d.style.visibility = 'hidden';
> crmForm.all.new_parentsupplierid_d.style.position = 'absolute'
> }
> crmForm.all.parentcustomerid.ForceSubmit = true;
> 
> Everything works perfectly except for one small glitch. If I 'Save', the 
> fields that are null disappear however if I 'Save and Close' and reopen the 
> form the fields that are null reappear. I am trying to use the ForceSubmit = 
> true however this does not seem to be working.
> 
> Would you assist me with this last bit?
> 
> Thanks again for all your help.
> Mark
> 
> "Niths" wrote:
> 
> > Hi Mark,
> > 
> > Where did you put this script? Did you put in the onChange event of the 
> > lookups?
> > 
> > HTH,
> > Niths
> > 
> > "Mark Braithwaite" wrote:
> > 
> > > Hi Niths
> > > 
> > > Thanks again for your reply. I tested the following script:
> > > 
> > > var lkupval1 = crmForm.all.new_parentsupplierid.DataValue;
> > > 
> > > if (lkupval1[0] != null)
> > > {
> > > crmForm.all.parentcustomerid_c.style.display = 'none';
> > > crmForm.all.parentcustomerid_d.style.display = 'none';
> > > crmForm.all.new_parentbusinesspartnerid.style.display = 'none';
> > > crmForm.all.new_parentbusinesspartnerid.style.display = 'none';
> > > }
> > > 
> > > var lkupval1 = crmForm.all.new_parentbusinesspartnerid.DataValue;
> > > 
> > > if (lkupval1[0] != null)
> > > {
> > > crmForm.all.parentcustomerid_c.style.display = 'none';
> > > crmForm.all.parentcustomerid_d.style.display = 'none';
> > > crmForm.all.new_parentsupplierid.style.display = 'none';
> > > crmForm.all.new_parentsupplierid.style.display = 'none';
> > > }
> > > 
> > > var lkupval1 = crmForm.all.parentcustomerid.DataValue;
> > > 
> > > if (lkupval1[0] != null)
> > > {
> > > crmForm.all.new_parentsupplierid.style.display = 'none';
> > > crmForm.all.new_parentsupplierid.style.display = 'none';
> > > crmForm.all.new_parentbusinesspartnerid.style.display = 'none';
> > > crmForm.all.new_parentbusinesspartnerid.style.display = 'none';
> > > }
> > > 
> > > I received an error message stating that '0' or is null or not an object. 
> > > Any ideas why this occurring? 
> > > 
> > > Thanks so much for your help.
> > > 
> > > Regards
> > > Mark
> > > 
> > > "Niths" wrote:
> > > 
> > > > Hi Mark,
> > > > 
> > > > Try this:
> > > > 
> > > > var lkupval1 = crmForm.all.new_parentsupplierid.DataValue;
> > > > 
> > > > if (lkupval1[0] != null) 
> > > > {
> > > >     crmForm.all.new_parentbusinesspartnerid_c.style.display="none";
> > > >     crmForm.all.new_parentbusinesspartnerid_d.style.display="none";
> > > >     crmForm.all.new_parentcustomerid_c.style.display="none";
> > > >     crmForm.all.new_parentcustomerid_d.style.display="none";
> > > > }
> > > > 
> > > > and likewise for the parentbusinesspartnerid and parentcustomerid fields.
> > > > 
> > > > HTH,
> > > > Niths
> > > > 
> > > > "Mark Braithwaite" wrote:
> > > > 
> > > > > Hi Niths
> > > > > 
> > > > > Thanks for your reply. Okay so the begining of part of my script would be 
> > > > > if 
> > > > > crmForm.all.new_parentsupplierid.nextSibling.InnerText II
> > > > > crmForm.all.new_parentbusinesspartnerid.nextSibling.InnerText II
> > > > > crmForm.all.parentcustomerid.nextSibling.InnerText != null 
> > > > > then ........
> > > > > 
> > > > > My question is how do I hide only the fields that are null if one of them is 
> > > > > populated. To be honest I may be lacking the skills to write the Jscript 
> > > > > required. Appreciate your assistance.
> > > > > 
> > > > > Thanks again
> > > > > Mark
> > > > > 
> > > > > "Niths" wrote:
> > > > > 
> > > > > > Hi Mark,
> > > > > > 
> > > > > > How about using If..then constructs to check if a value is present in one of 
> > > > > > the three lookup fields?
> > > > > > 
> > > > > > To get the value in a lookup, you would need to use:
> > > > > > crmForm.all.lookupfield.nextSibling.InnerText
> > > > > > 
> > > > > > Do write in if you have problems using this script.
> > > > > > 
> > > > > > HTH,
> > > > > > Niths
> > > > > > 
> > > > > > "Mark Braithwaite" wrote:
> > > > > > 
> > > > > > > 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. 
> > > > > > > 
> > > > > > > If I use the On Save event, the question is, how do I hide the remaining 
> > > > > > > fields if a certain value is selected in one of the fields? I only want to 
> > > > > > > hide the fields that are not populated. 
> > > > > > > 
> > > > > > > I suppose I could use a script which if all fields are null then do nothing 
> > > > > > > however if one of the fields are populated then hide the fields that are 
> > > > > > > null. How would you translate this into Jscript? 
> > > > > > > 
> > > > > > > I created a custom field named 'Contact Type' and tested the following script:
> > > > > > > 
> > > > > > > var type = crmForm.all.new_contacttype.SelectedText;
> > > > > > > switch (type)
> > > > > > > { 
> > > > > > > case "Business Partner
> > > > > > > crmForm.all.parentcustomerid.style.visibility = 'hidden';
> > > > > > > crmForm.all.parentcustomerid.style.position = 'absolute';
> > > > > > > crmForm.all.parentcustomerid_c.style.visibility = 'hidden';
> > > > > > > crmForm.all.parentcustomerid_c.style.position = 'absolute';
> > > > > > > crmForm.all.parentcustomerid_d.style.visibility = 'hidden';
> > > > > > > crmForm.all.parentcustomerid_d.style.position = 'absolute';
> > > > > > > crmForm.all.new_parentbusinesspartnerid.style.visibility = 'visible';
> > > > > > > crmForm.all.new_parentbusinesspartnerid.style.position = 'relative';
> > > > > > > crmForm.all.new_parentbusinesspartnerid_c.style.visibility = 'visible';
> > > > > > > crmForm.all.new_parentbusinesspartnerid_c.style.position = 'relative';
> > > > > > > crmForm.all.new_parentbusinesspartnerid_d.style.visibility = 'visible';
> > > > > > > crmForm.all.new_parentbusinesspartnerid_d.style.position = 'relative'; 
> > > > > > > crmForm.all.new_parentsupplierid.style.visibility = 'hidden';
> > > > > > > crmForm.all.new_parentsupplierid.style.position = 'absolute';
> > > > > > > crmForm.all.new_parentsupplierid_c.style.visibility = 'hidden';
> > > > > > > crmForm.all.new_parentsupplierid_c.style.position = 'absolute';
> > > > > > > crmForm.all.new_parentsupplierid_d.style.visibility = 'hidden';
> > > > > > > crmForm.all.new_parentsupplierid_d.style.position = 'absolute'; 
> > > > > > > 
> > > > > > > case "Supplier"
> > > > > > > crmForm.all.parentcustomerid.style.visibility = 'hidden';
> > > > > > > crmForm.all.parentcustomerid.style.position = 'absolute';
> > > > > > > crmForm.all.parentcustomerid_c.style.visibility = 'hidden';
> > > > > > > crmForm.all.parentcustomerid_c.style.position = 'absolute';
> > > > > > > crmForm.all.parentcustomerid_d.style.visibility = 'hidden';
> > > > > > > crmForm.all.parentcustomerid_d.style.position = 'absolute';
> > > > > > > crmForm.all.new_parentbusinesspartnerid.style.visibility = 'hidden';
> > > > > > > crmForm.all.new_parentbusinesspartnerid.style.position = 'absolute';
> > > > > > > crmForm.all.new_parentbusinesspartnerid_c.style.visibility = 'hidden';
> > > > > > > crmForm.all.new_parentbusinesspartnerid_c.style.position = 'absolute';
> > > > > > > crmForm.all.new_parentbusinesspartnerid_d.style.visibility = 'hidden';
> > > > > > > crmForm.all.new_parentbusinesspartnerid_d.style.position = 'absolute'; 
> > > > > > > crmForm.all.new_parentsupplierid.style.visibility = 'visible';
> > > > > > > crmForm.all.new_parentsupplierid.style.position = 'relative';
> > > > > > > crmForm.all.new_parentsupplierid_c.style.visibility = 'visible';
> > > > > > > crmForm.all.new_parentsupplierid_c.style.position = 'relative';
> > > > > > > crmForm.all.new_parentsupplierid_d.style.visibility = 'visible;
> > > > > > > crmForm.all.new_parentsupplierid_d.style.position = 'relative';
> > > > > > > break;
> > > > > > > 
> > > > > > > case "Customer"
> > > > > > > crmForm.all.parentcustomerid.style.visibility = 'visible';
> > > > > > > crmForm.all.parentcustomerid.style.position = 'relative';
> > > > > > > crmForm.all.parentcustomerid_c.style.visibility = 'visible';
> > > > > > > crmForm.all.parentcustomerid_c.style.position = 'relative';
> > > > > > > crmForm.all.parentcustomerid_d.style.visibility = 'visible';
> > > > > > > crmForm.all.parentcustomerid_d.style.position = 'relative';
> > > > > > > crmForm.all.new_parentbusinesspartnerid.style.visibility = 'hidden';
> > > > > > > crmForm.all.new_parentbusinesspartnerid.style.position = 'absolute';
> > > > > > > crmForm.all.new_parentbusinesspartnerid_c.style.visibility = 'hidden';
> > > > > > > crmForm.all.new_parentbusinesspartnerid_c.style.position = 'absolute';
> > > > > > > crmForm.all.new_parentbusinesspartnerid_d.style.visibility = 'hidden';
> > > > > > > crmForm.all.new_parentbusinesspartnerid_d.style.position = 'absolute'; 
> > > > > > > crmForm.all.new_parentsupplierid.style.visibility = 'hidden';
> > > > > > > crmForm.all.new_parentsupplierid.style.position = 'absolute';
> > > > > > > crmForm.all.new_parentsupplierid_c.style.visibility = 'hidden';
> > > > > > > crmForm.all.new_parentsupplierid_c.style.position = 'absolute';
> > > > > > > crmForm.all.new_parentsupplierid_d.style.visibility = 'hidden';
> > > > > > > crmForm.all.new_parentsupplierid_d.style.position = 'absolute';
> > > > > > > break;
> > > > > > > 
> > > > > > > This script was unsuccessful and I would ideally prefer not to create the 
> > > > > > > custom field named 'Contact Type'.
> > > > > > > 
> > > > > > > Thanks very much
> > > > > > > 
> > > > > > > 
0
Niths (71)
4/9/2008 12:29:00 PM
Mark,

if you are using client side code to modify the appearance of the screen, 
you have to use the onLoad or the onChange events. If you are using the 
onSave event, your changes will be lost when the screen is reloaded.

I used the following code (in the onLoad) in the past:
http://crm.atechnisch.nl/2008/01/25/hiding-empty-fields/

Good luck.

regards

Huib


0
Utf
4/16/2008 7:02:00 AM
Reply:

Similar Artilces:

need to concatenate field
Hi, I need to concatenate a field, and sum another field, grouping the first field. Acct legalDescrip acres 77 Parcel-1Text 10 77 Parcel-2Text 20 77 Parcel-3Text 5 80 Parcel-1Text 11 86 Parcel-1Text 12 86 Parcel-2Text 12 The result I need: Acct legalDescrip acres 77 Parcel-1Text;Parcel-2Text;Parcel3Text 35 80 Parcel-1Text 5 86 Parcel-1Text;Parcel-2Text 24 For some records, the total of the LegalDescription...

Calendar control on protected form with multiple date fields
How do a reference the formfield on a protected form to insert a date from a datepicker? I have 3 date fields, it seems I can insert a date based on the field selected i.e. selection.formfields("x")=calendar1.value Any help is appreciated. thanks -- See http://www.gmayor.com/popup_calendar.htm -- <>>< ><<> ><<> <>>< ><<> <>>< <>><<> Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org <>>< ><<> ><<> ...

hiding a worksheet #2
can i hide a worksheet -- Message posted from http://www.ExcelForum.com Click on: Format Sheet Hide Regards Sarah --- Message posted from http://www.ExcelForum.com/ ...

Date & Time Field
I am running Excel 2003. I have a field that combines both date and time (MM/DD/YYYY HH:MM:SS AM or PM). I would like to know if there is a way break this field into a date field (MM/DD/YYYY) and a time field (HH:MM). Thanks. Hi Diane For Date = INT(A1) format as a suitable Date format For Time =MOD(A1,1) format as hh:mm -- Regards Roger Govier "Diane Walker" <ett9300@yahoo.com> wrote in message news:OpkM6IXFGHA.2652@tk2msftngp13.phx.gbl... >I am running Excel 2003. I have a field that combines both date and >time (MM/DD/YYYY HH:MM:SS AM or PM). I wou...

field chooser won't keep
Outlook 2003 Windows XP I choose the fields I want for my various folders (inbox, sent, deleted, etc) But every so often, my selection goes away (for example, my send box insists are saying who the emails are FROM instead of TO, I know that I sent them).. Any suggestions? -- Meg "Our lives begin to end the day we become silent about things that matter" - MLK the views are getting reset or otherwise messing up. Use the method at http://www.outlook-tips.net/howto/grouping.htm to reset the views and then customize the views. -- Diane Poremsky [MVP - Outlook] Author, Teac...

hide grid lines
How can I hide gridlines ONLY for selected areas of a worksheet ? Nope. But you could turn them off and add borders to your favorite areas. (Format|Cells|Border tab). Or maybe kind of... If you apply a fill color to any range, then the grid lines in that area won't be seen. (Fill color of white???) mankoni@gmail.com wrote: > > How can I hide gridlines ONLY for selected areas of a worksheet ? -- Dave Peterson ...

Posting to Public Folder-VIEW--the FROM field
When I post to a public folder, and click VIEW--the FROM field is grayed out. This worked in Outlook 2000. Are there any work-arounds? ...

Hide/lock worksheets
I have a workbook with 10 spreadsheets. Each sheet/tab is for individual employees. Is there a way to have a user sign in and only view their own tab and not gain access or even hide the other employees sheets/tabs? You can have a sign-in sheet that would display when the file is opened. You could then have a drop-down in a cell that would display all the names. The user would select a name (his own, presumably) and his sheet would be displayed. But what is there to prevent him from selecting another name than his own? Well, Excel could ask for a password. All of this would ...

Copying and hiding issues...
Hi, I need to create a macro which will copy A5:A500 on all grouped sheet and paste them onto column A in a hidden worksheet "Shipped". The har part for me is one, I need to omit the blank spaces, and two, thi macro will be ran numerous times so I need it to continue from the las cell containing data the next time it is ran. Awaiting some muc needed help. Best Regards, Mjac -- Message posted from http://www.ExcelForum.com Something like this??? Option Explicit Sub testme01() Dim ShippedWks As Worksheet Dim wks As Worksheet Dim DestCell As Range Set Shipp...

How to hide a GUI program with systray icon?
Hi, Everybody! I have a GUI program which can minimize itself to the systray; What I need to do is to hide it's systray icon so that people won't know it is running by looking at my screen. Will it do if I hook Shell_NotifyIcon? Thanks! You can hide the icon by simply removing it. And show it by simply reinserting the icon in the taskbar. AliR. <j012xjj@gmail.com> wrote in message news:1153114375.184762.88760@m73g2000cwd.googlegroups.com... > Hi, Everybody! > > I have a GUI program which can minimize itself to the systray; What I > need to do is to hide it'...

How can I default a lookup field to a particular value.
How can I default a lookup field to a certain value, but still allow the user to modify the field if necessary? Thanks, Bob Johnson you mean a drop down or picklist? "Bob" <rjohnson@reveregroup.com> wrote in message news:1130947400.655495.115390@f14g2000cwb.googlegroups.com... > How can I default a lookup field to a certain value, but still allow > the user to modify the field if necessary? > > Thanks, > > Bob Johnson > i have the same question in crm 3.0. i want a default value in a lookup filed. i also want to create a lookup field by my self....

JScript compilation error
I keep getting a pop-up Jscript compilation error that says Expected ';' When I click off or okay it disappears only to reappear. It comes up all the time and I would fix it if I knew how. Does anyone have any suggestions? Thanks When does this come up? Directly when starting Outlook or when doing something "special" first? Does it work correctly in Outlook Safe Mode? Start-> Run; outlook.exe /safe (note the space in the command) If it does, it is probably caused by an add-in. Turn them all off and then enable them one by one until you found the culprit;...

Hiding Pie Slice When Value is Zero
My data labels contain the Value and Percentage. I can hide the Value of a slice (when its value=0) when I set its format to ;000. But I can't figure out how to not display the slice since the data label Percentage still shows up as 0%. Any help would be greatly appreciated. Thanks, Bob Why not just filter the data (showing only >0) and use the entire (unfiltered) range as source data. The chart will not show hidden values - only the filtered values. Sandy "Bob" <Bob@discussions.microsoft.com> wrote in message news:91337249-7D87-4CCC-8B06-D1174A5AF212@microsoft...

memo field of OFX file not displayed in MS Money Essentials
I'm trying to figure out where all my money is going each month, so I downloaded an OFX file from myonline banking account, then imported it into the trial version of MS Money Essentials. Money assigned categories to each transaction and they are all completely wrong, so I've had to start reassigning them manually. It would make my life much easier if Money displayed the memo field so I could see "McDonalds" vs. having to go back to the online account and see what the transaction on this date for that amount was for. It's going to take forever to match them that way. ...

Update on MSCRM Jscript problem
I have discovered that if you replace window.open('http://strongbad/reports/viewer/html/viewer.aspx?id=398&sf=({qu ote.quotenumber})=\'QUO-01002-9QRYHR\'') with window.open('http://strongbad/reports/viewer/html/viewer.aspx?id=398%26sf=({ quote.quotenumber})=\'QUO-01002-9QRYHR\'') (replace the & with a %26) in the onchange event of a picklist, the quote page will display and you can call the report by changing the value in the picklist. However, you will get an error returned by the report viewer that doesn't like the %26. If, in the report view...

how to hide the check boxes of some items in CTreeCtrl?
Hi, I have a CTreeCtrl and set its property "Checkboxes" as true. Then all items have a checkbox to the left of them. I wonder if I can hide some of these checkboxes. For example, if I have two levels in my CTreeCtrl, I only want to show checkboxes for the 2nd level items. Is it possible? It seems that CTreeCtrl doesn't have such a member function to make it happen. Your help is much appreciated. JD "JD" <jdt_young@yahoo.com> wrote in news:OREmHoEaIHA.5160@TK2MSFTNGP05.phx.gbl: > Hi, > > I have a CTreeCtrl and set its property "Ch...

Jscript Array...
Hey again, So this is really annoying me :-( I have some really great code, which I'll post below in a second, but here's what I'm trying to do: I have "reseverved chartacters" that are stored in a single data record (along with other values) from a custom CRM Entity. I query this entity to retrieve the values and assign them to variables in my JScript code. I want to load the value from the "Reserved Characters" field into an Array. When I hard code these values into an array, of course they work. But when the same string from the data field is loaded ...

Searching for Field Names
Sorry guys, I did not know where to post this question. I need to search all my .asp and html files for a field name. The name of the field is SchlDstrct. I have over 2,500 pages and have run into some kind of weird problem with this field in my databases. It goes without sayin that I cannot remember where I used this variable name. I have used the standrad search on my server, but it never finds the name. How can I get this done? Thank You in Advance John John wrote: > Sorry guys, I did not know where to post this question. > > I need to search all my...

Split Field
I have in a field lastname,firstname I want to split this field into to fields lastname and firstname. Please help Binder Select the data and use Data/Text to Columns with a comma delimiter. Andy. "Binder" <anonymous@discussions.microsoft.com> wrote in message news:B36B0140-4291-4E32-B1AF-07C3DC82BD27@microsoft.com... > I have in a field lastname,firstname I want to split this field into to fields lastname and firstname. Please help ...

WMP and jscript
How can I, using jscript, retrieve the name of the data-stream or file that WMP is playing at the moment? My goal is to post the name in a specialized text log, which will have have "xxxx is playing at mm/dd/yy hh:mm:ss" entries for each time a sample is taken from WMP. If this can't be done in jscript, perhaps vbscript? Or some other "batch" language? Your thoughts appreciated! Thanks. ....Charlie You can do this using the WMP Object Model, which is documented at http://msdn.microsoft.com/en-us/library/dd564679%28VS.85%29.aspx The sections regardi...

calculated field in pivot
Hello, I have a pivot with calculated fields in, however they seem to be bringing back incorrect data eg. Total Number of points: 23 Number of correct points: 16 Percent correct: 61.1% where it should read 69.5% now I need to know how I can view what formula has been used so that I can correct it. Thank you Tracey Need sample of source, pt and cf data. You are doing something wrong. Check the references very carefully. I've been using pivot tables since, well, for a very long time and I've never once experienced the kind of results you are describing. ...

Can Someone help me with some JScript
Hey, I was wondering if someone could help figure out how to log realtime phone call durations... This is for telemarketers... (though it could be applied for many activity situations... The business scenario: Using the MS CRM RSS feed add-on, the telemarketer is reminded of their call time (pretty nifty) if they are free, they open the Phone call record and once they connect, they'd click a bit field (checkbox) called "Start Timer". (If I get really fancy, I'd like the textbox label to change to "Stop Timer", which I think has been documented in this forum...

JScript for phone formatting
I need a JScript for phone formatting on a phone field. Please help. fomrat: (xxx)xxx-xxxx Mircorosft provides a script example to do exactly what you're trying to do here. Go to: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/CrmSdk3_0/htm/v3d0microsoftcrmv3d0sdk.asp On the help navigation column, drill down to: Client Programming Guide > Client Side Scripting > Events > Field Events - OnChange -- David Wasserman www.grandconsult.com "HEC" wrote: > I need a JScript for phone formatting on a phone field. Please help. > > fo...

Split field
We would like to split a field which has sometimes 3,4,5, word in the field the split should be as follows left word shall be copied in 1 cell, right word in 1 cell ,all middle words together in 1 cell On Fri, 28 Dec 2007 10:13:02 -0800, dk <dk@discussions.microsoft.com> wrote: >We would like to split a field which has sometimes 3,4,5, word in the field >the split should be as follows left word shall be copied in 1 cell, right >word in 1 cell ,all middle words together in 1 cell A1: original string B1: =LEFT(TRIM(A1),FIND(" ",TRIM(A1))-1) C1: =MID(TRIM(A1),...

Access Acount info from JScript on a from
Hi I have my oppertunity form that will be populated with an account name (in prospective customer field) I need to then extract the account status (credit limit etc) of that account on change. Is that possible? Any clues would be great. Thanks not from within the opportunity as the account is the parent here i believe. it would have been possible if it was the way around. you can either create a webservice call to retrieve the information needed from within your jscript on the OnChange event. However, i got a better way of doing this, why do not you get the account status when you...