Expand my Community achievements bar.

Interdependency among the fields (data dependency between fields), JS pls.

Avatar

Level 8

Hello

My question looks like lenghty, but i eloborated for a easy understanding, we can say same thing briefly also.

I have 5 fields on the interactive form in my_subform, all these 5 field's data entry is inter-dependable, its like as below (the order of position of the fields on the form are as the same as from top to down of the below indicated/numbered, i mean, first comes Bank acct # then comes city.....but user flexible enter the data in any order as his/her wish) pls. provide me JavaScript for the below sceanrios (as i am new to this, pls. make sure no syntax errors, Thank you......if if you would like or if you feel FormCalc is easy/quick, then FormCalc also fine pls.),

Pls. note this my_subform has some additional other fields

1st field: Bank account number - text field

2nd:  Bank located city: its drop-down field, the entries of this drop-down are 2 in number and they are City_1 and City_2

3rd: Collection box: Its a check box, so, values are Yes to No

4th: Credit facility: Its also a check box

5th: Debit facility: Its also a check box

Scenarios:

1st Scenario:

If user did NOT entered any data on Bank acct #, then

- Dropd-down should automatically populated/defaulted by JS to City_2

- If user tries to selects City_1  forcebly, then JS alert message, once user clicks the OK on the JS alert popup, then, again JavaScript (JS) default back to City_2

- Make Collection Box check box greyed out and read-only 

- Make last 2 check boxes (Debit and Cedit facility) also should greyed out with read-only

2nd Scenario:

If user entered Bank acct # AND user selected City_1 in Dropd-down, then,

-  Make Debit facility check box should defaulted/auto populated with Yes/X and make it greyed out with read-only

3rd Scenario:

If user entered Bank acct # AND If user selected City_2 in Dropd-down, then,

-  Debit facility check box should make it greyed out with read-only

4th Scenario:

If user checks the Debit facility check box, then,

- User must enter data in Bank acct. #, i mean, Bank acct # will become as mandatory/required input field... else error / alert popup message

5th Sceanrio:

If user checks the Collection Box check box, then,

- User must to enter the Bank acct. # AND

- User either must to check the check box of Debit facility OR user  must to check the check box of Credit facility or Both checking also fine

Pls. note the user has freedom to enter/change/update/modify.wipe off data on all these 5 fields, i mean, for example, user entered data in Bank acct # and after 1 min. changed mind and wiped off Bank acct #, then the JS should immediately change other 4 fobjects according to the above said business rules, if previously some object greyed out with read-only, then immediatekly should become while color and ready-for-input field

Can i make all these 5 fields into a GROUP and write the JS on CHANGE event of this GROUP?

Thank you

3 Replies

Avatar

Level 10

Hi,

It can be achieved and there are various examples on the forum showing how to approach a task like this.

However it takes time to prepare each example and in your case it would be much easier, if you shared the form. This way someone could provide script that matched your form structure.

If you can, upload your form to a file sharing site; publish it and then share the URL here.

Niall