I'm using crmForm.SetReqLevel("field", x); to dynamically set the requirement
level of attributes on my forms. I can't, however, figure out how to set the
requirement level to Recommended in this same fashion.

RE: SetReqLevel() by ReeceWilliams

ReeceWilliams
Sun Jul 30 22:40:02 CDT 2006

You can't do it in this fashion - it's just not an option.

You can do it manually using the following code (which is unsupported by MS):

var REQUIRED = "req";
var RECOMMENDED = "rec";

// --- set recommended
crmForm.all.myfield.req = 1;

// --- change the label style to recommended
var oFieldLabel = crmForm.all.myfield.id + "_c";
if (oFieldLabel == null) return;

var sClassName = oFieldLabel.className;

if (sClassName.indexOf(RECOMMENDED) != -1) return;

if (sClassName.indexOf(REQUIRED) != -1)
{
oFieldLabel.className = sClassName.replace(REQUIRED, RECOMMENDED);
}
else
{
oFieldLabel.className = sClassName + (sClassName == "" ? RECOMMENDED : " "
+ RECOMMENDED);
}


HTH,
R.


"Chris" wrote:

> I'm using crmForm.SetReqLevel("field", x); to dynamically set the requirement
> level of attributes on my forms. I can't, however, figure out how to set the
> requirement level to Recommended in this same fashion.

RE: SetReqLevel() by Chris

Chris
Tue Aug 01 14:58:02 CDT 2006

Thanks, I thought this was the case, but was hoping something was out there
hiding from me. I don't like using Business Rec. anyhow, so I'll probably
just not use it. ;)

"Reece Williams" wrote:

> You can't do it in this fashion - it's just not an option.
>
> You can do it manually using the following code (which is unsupported by MS):
>
> var REQUIRED = "req";
> var RECOMMENDED = "rec";
>
> // --- set recommended
> crmForm.all.myfield.req = 1;
>
> // --- change the label style to recommended
> var oFieldLabel = crmForm.all.myfield.id + "_c";
> if (oFieldLabel == null) return;
>
> var sClassName = oFieldLabel.className;
>
> if (sClassName.indexOf(RECOMMENDED) != -1) return;
>
> if (sClassName.indexOf(REQUIRED) != -1)
> {
> oFieldLabel.className = sClassName.replace(REQUIRED, RECOMMENDED);
> }
> else
> {
> oFieldLabel.className = sClassName + (sClassName == "" ? RECOMMENDED : " "
> + RECOMMENDED);
> }
>
>
> HTH,
> R.
>
>
> "Chris" wrote:
>
> > I'm using crmForm.SetReqLevel("field", x); to dynamically set the requirement
> > level of attributes on my forms. I can't, however, figure out how to set the
> > requirement level to Recommended in this same fashion.