Answered by:
Firing hidden fields On Change

Question
-
Hi
I'm looking for a good guide that will start me down the track of hiding fields on forms and then having them fire based on the picklist value of another field.
I am a novice at this so 'idiots guides' are applicable.
Thanks in advance
Dave
Wednesday, August 18, 2010 9:01 AM
Answers
-
Hi Dave,
Please see the below link which has lot of examples like hiding fields [and other javascript examples: playing with MS CRM forms / attributes]:
Hoep this helps
Thanks, Ranjitsingh R | http://mscrm-developer.blogspot.com/ | MS CRM Consultant- Proposed as answer by Ranjitsingh R Wednesday, August 18, 2010 12:27 PM
- Marked as answer by Dave0109 Saturday, August 21, 2010 10:25 AM
Wednesday, August 18, 2010 12:27 PM
All replies
-
Hi Dave,
Do you want to execute it on client side?
If yest then through javascript make the visiblity as false by getting an element through document.getelementbyid().
Wednesday, August 18, 2010 9:09 AM -
you can write simple JS script onchange of your picklist as below, remember you also have write this code on form onload
like for example you want to hide another field name "newField" when anybody will select first option from picklist so here will be the code for that
if(crmForm.all.<PicklistFieldName>.DataValue=="1")
{
crmForm.all.newField_c.style.display='none';
crmForm.all.newField_d.style.display='none';
}
Let us know if you need any other information
Mahain : http://mahenderpal.wordpress.com- Proposed as answer by HIMBAPModerator Wednesday, August 18, 2010 9:12 AM
Wednesday, August 18, 2010 9:11 AMModerator -
If initially you want to hide the field & then based on picklist value want to make them visible then :
OnLoad event of Form :
crmForm.all.FieldName_c.style.display="hidden";
crmForm.all.FieldName_d.style.display="hidden";
& to make it visible again add follwing code in OnChange of picklist attribute :
crmForm.all.FieldName_c.style.display="visible";
crmForm.all.FieldName_d.style.display="visible";
Thank You.
JayshriP
- Proposed as answer by JayshriP Wednesday, August 18, 2010 9:23 AM
Wednesday, August 18, 2010 9:20 AM -
Hi Dave,
Please see the below link which has lot of examples like hiding fields [and other javascript examples: playing with MS CRM forms / attributes]:
Hoep this helps
Thanks, Ranjitsingh R | http://mscrm-developer.blogspot.com/ | MS CRM Consultant- Proposed as answer by Ranjitsingh R Wednesday, August 18, 2010 12:27 PM
- Marked as answer by Dave0109 Saturday, August 21, 2010 10:25 AM
Wednesday, August 18, 2010 12:27 PM -
Hi Jayshir
What does the _c & _d do? Is one the field and one the field name?
Appreciate your help.
Dave
Saturday, August 21, 2010 10:27 AM -
In forms, crm attributes don't have property that allows hiding them...
So the only way to hide a field is to find the label '_c', the control '_d' and hide them
My blog : http://mscrmtools.blogspot.com
All my tools on my new dedicated site: MSCRMTools RepositorySaturday, August 21, 2010 10:49 AMModerator -
Hi Jayshir
What does the _c & _d do? Is one the field and one the field name?
Appreciate your help.
Dave
"crmForm.all.fieldName_c " refers to field label on the form & "crmform.all.fieldName_d" refers to the actual control for field/attribute on the form.Thank you.
JayshriP.
Monday, August 23, 2010 4:32 AM -
Right, thanks for all the advice.
I've added the following code:
if(crmForm.all.sec1_loggingsolution.DataValue == 7)
{
crmForm.all.sec-1_loggingother_c.style.display = 'inline';
crmForm.all.sec-1_loggingother_d.style.display = 'inline';
}
else
{
crmForm.all.sec-1_loggingother_c.style.display = 'none';
crmForm.all.sec-1_loggingother_d.style.display = 'none';
}This seems to work fine based on the pick list trigger however the sec1_loggingother field only appears "on save", is this right or can it be instant?
Monday, August 23, 2010 12:23 PM -
"OnLoad" if crmFormType="UPDATE" then also you can check for picklist datavalue & then hide/show "sec1_loggingother " field accordingly. In case of new record i.e. OnLoad if crmFormType="CREATE" then sec1_loggingsolution.DataValue might be null & "sec1_loggingother" will not appear on form (because as per your code it will satisfy ELSE part) .
Thank you.
JayshriP.
Tuesday, August 24, 2010 5:12 AM