I have a requirement of highlighting conditonally required fields in my form. Details of which are given below
1. When CheckBox Trading relevant is checked then asterisk (mandatory field marker) should appear in the captions of the next 4 fields.
2. Similarly if Bank Account Number is entered then payment method field will also be mandatory (so a mandatory marker asterisk will appear in the caption for payment method)
Illustrating point # 2, we have 3 fields for e.g.
Bank Account Number
Payment Method (conditionally reqd if Bank Acct Number has been filled up)
Exact requirement is when the cursor is in the Bank Account Number field the Payment Method field caption should have a asterisk, once the cursor moves from Bank Acct Number field to any of the two fields following the Bank Acct Number field,
then the asterisk should disappear indicating the payment method field is no longer mandatory. Again if the cursor moves to the Bank Acct Number field (field coming back to focus) the asterisk should again appear in the caption for Payment Method.
Please let me know the java scripting required and also the exact events in which I need to place these scripts to fulfiil the requirement
There are a couple of ways to achieve this. You can change the caption of a field at runtime.
So in the mouseEnter event of Bank Account Number:
paymentMethod.caption.value.#text = "Payment Method * ";
Then in the exit event of the Bank Account Number:
paymentMethod.caption.value.#text = "Payment Method";
The only concern is that the user may get confused between fields becoming mandatory / optional, based on where the mouse is hovering at any one time.
Maybe what you want is if the field is not null then the payment method is mandatory. The same script will change the caption, you would just put it in a different event and have it in an if statement.
Reopened this query for a specific additional requirement - the asterisk that you are putting needs to be in red color font while the rest of the caption remains in the default color.
" Payment Method * "
Is it possible to specify the color of the caption text thru scripting?
Thanks and Regards.
Stefan Cameron has a blog post, with a sample of what you are looking for: http://forms.stefcameron.com/2009/03/16/auto-identify-mandatory-fields /
I haven't looked at the script as yet, but he does have a sample and fragment for download.
Hope that helps,