Skip navigation
rohitacmilan
Currently Being Moderated

Highlighting Conditionally Reqd Fields

Dec 17, 2009 4:29 AM

Hi Experts,
                 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)

 

Bank Country

 

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

 

Thanks

Rohit

 
Replies
  • Currently Being Moderated
    Dec 17, 2009 8:10 AM   in reply to rohitacmilan

    Hi,

     

    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.

     

    Good luck,

     

    Niall

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 18, 2009 2:34 AM   in reply to rohitacmilan

    Hi,

     

    Here is a sample; drop the # from the script and make sure the file is saved as dynamic.

     

    Good luck,

     

    Niall

    Attachments:
     
    |
    Mark as:
  • Currently Being Moderated
    Mar 30, 2010 10:30 AM   in reply to rohitacmilan

    Hi Rohit,

     

    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,

     

    Niall

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points