javascript - CRM 2011 - Set field's 'requiredlevel' to REQUIRED based on another field's value -
i working on opportunity form in crm 2011.
i have 2 fields working with: azdb_payment1type & new_payment1cclast4orcheckgc
azdb_payment1type has option set values:
- visa = 807,370,000
- mastercard = 807,370,001
- american express = 807,370,002
- discover = 807,370,003
- check = 807,370,004
- cash = 807,370,005
- credit rollover = 807,370,006
if value of field (azdb_payment1type) 807,370,004 or less, i'd require new_paymentcclast4orcheckgc field filled out.
i created function azdb_payment1type field called "requirecclast_onchange", added below code form's main library:
function requirecclast_onchange() { var payment1type = xrm.page.getattribute('azdb_payment1type').getvalue(); alert(payment1type); if (payment1type <= '807,370,004') { xrm.page.getattribute("new_payment1cclast4orcheckgc").setrequiredlevel("required"); } }
with code inserted onchange, nothing happens when select cc, tab off field. if change function onsave, edit library changes, return alert set in code, doesn't change requirement level "business recommended" "required".
is possible javascript?
i have @ line. payment1type <= '807,370,004'
you comparing number string, i'm not sure have javascript resolve can't imagine way want.
i believe should doing, payment1type <= 807370004
Comments
Post a Comment