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,