Geordie2008
Registered User.
- Local time
- Today, 04:13
- Joined
- Mar 25, 2008
- Messages
- 177
Hi All,
I have 2 fields which will determine which fields on a form are enabled.
1) [Employee Indicator] "Employee" or "Non employee
2) [Employee Status] "Active" or "Inactive"
If the person is an "Employee" and "Inactive" then only 1 field should be enabled called [Inactive_Status] all others should be disabled.
If the person is a "Non Employee" then I want to set the value of[Employee Status] to "Inactive" and then all fields except the following should be disabled on the form:
[Reason_for_leaving]
[Replaced]
[Replaced_by]
else if The person is an "Employee" and "Active" then all enabled except:
[Reason_for_leaving]
[Replaced]
[Replaced_by]
[Inactive_Status]
I have written some VERY messy code to try and do this, but I have ended up listing all of my form fields and then either putting enabled = true or emabled = false.
Its likely Im going to have to add in fields to the form so I would like to set them all (as appropriate within the "if" statements described above) to be enabled and then disable key fields as necessary. O where appropriate set them all to disabled and then enable key fields (if this is possible)
Is there a less messy way of doing this? Maybe by naming a list of all fields and then calling this list within the code? I just dont want code that is several pages long (I have c.40 fields)
Thanks,
Mandy
I have 2 fields which will determine which fields on a form are enabled.
1) [Employee Indicator] "Employee" or "Non employee
2) [Employee Status] "Active" or "Inactive"
If the person is an "Employee" and "Inactive" then only 1 field should be enabled called [Inactive_Status] all others should be disabled.
If the person is a "Non Employee" then I want to set the value of[Employee Status] to "Inactive" and then all fields except the following should be disabled on the form:
[Reason_for_leaving]
[Replaced]
[Replaced_by]
else if The person is an "Employee" and "Active" then all enabled except:
[Reason_for_leaving]
[Replaced]
[Replaced_by]
[Inactive_Status]
I have written some VERY messy code to try and do this, but I have ended up listing all of my form fields and then either putting enabled = true or emabled = false.
Its likely Im going to have to add in fields to the form so I would like to set them all (as appropriate within the "if" statements described above) to be enabled and then disable key fields as necessary. O where appropriate set them all to disabled and then enable key fields (if this is possible)
Is there a less messy way of doing this? Maybe by naming a list of all fields and then calling this list within the code? I just dont want code that is several pages long (I have c.40 fields)
Thanks,
Mandy