Mutually exclusive checkbox fields in ms crm 4.0
-
quinta-feira, 17 de maio de 2012 08:57
Hi,
I have the below requirement
There are two checkbox fields that are mutually exclusive and the user must select exactly one choice. In other words, clicking a non-selected checkbox field will deselect whatever other check box field was previously selected.
Any help greatly appriciated!
Thanks,
Srikanth Reddy
- Editado Srikanth_MSCRM quinta-feira, 17 de maio de 2012 08:59
- Editado Srikanth_MSCRM quinta-feira, 17 de maio de 2012 09:01
Todas as Respostas
-
quinta-feira, 17 de maio de 2012 09:03
hi you need to write js,add a function on both the fileds.
register this one on field1 event and vice versa on field2
Xrm.Page.getAttribuet("filed2").setValue(false) Xrm.Page.getAttribuet("filed1").setValue(true);By Sanz. -- If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".
-
quinta-feira, 17 de maio de 2012 09:23
Thanks for your quick response! I need to implement this functionality in MS CRM 4.0.
I don't think it will work OnChange event handler of the fields, how can i do ?
-
quinta-feira, 17 de maio de 2012 09:48Moderador
Hello Srikanth,
To implement it you can use OnChange event handler with following syntax:
For first field:
crmForm.all.<Second field here>.DataValue = !crmForm.all.<First field here>.DataValue;
For second field:
crmForm.all.<First field here>.DataValue = !crmForm.all.<Second field here>.DataValue;
the this is that this script would be triggered only when checkbox will loose focus.
Microsoft CRM Freelancer
My blog (english)
Мой блог (русскоязычный)
- Editado Andrii ButenkoMVP, Moderator quinta-feira, 17 de maio de 2012 09:48
- Sugerido como Resposta Andrii ButenkoMVP, Moderator quinta-feira, 17 de maio de 2012 14:01
-
quinta-feira, 17 de maio de 2012 13:51
Thanks for your response! I have tried in other way by attaching OnClick event to the checkbox field in OnLoad event of the form. It is working fine for me.
crmForm.all.us_firstfield.onclick = function(){
if (crmForm.all.us_secondfeld.DataValue==true)
{
crmForm.all.us_secondfeld.DataValue=false;
}
}
-
quinta-feira, 17 de maio de 2012 14:00Moderador
Thanks for your response! I have tried in other way by attaching OnClick event to the checkbox field in OnLoad event of the form. It is working fine for me.
crmForm.all.us_firstfield.onclick = function(){
if (crmForm.all.us_secondfeld.DataValue==true)
{
crmForm.all.us_secondfeld.DataValue=false;
}
}
Unfortunately your code is not full. Following code will work without issues:
crmForm.all.us_firstfield.onclick = function() { crmForm.all.us_secondfeld.DataValue = !crmForm.all.us_firstfield.DataValue; }
Microsoft CRM Freelancer
My blog (english)
Мой блог (русскоязычный)
- Sugerido como Resposta Andrii ButenkoMVP, Moderator quinta-feira, 17 de maio de 2012 14:01