This topic is locked

Required if

9/11/2007 9:48:35 AM
ASPRunnerPro General questions
F
funkfish author

Hello,
How can I make a field required, if another field is selected form a drop-down?

Example:
Field 1 = Drop-down choices A or B

Field 2 = Required entry if Field 1 = A

Field 3 = Required entry if Field 1 = B
Thanks in advance!

Sergey Kornilov admin 9/11/2007

Sure, you can use BeforeAdd/BeforeEdit event to implement this logic.

if dict("Field1")="A" and dict("Field2")="" then

Response.Write "Field2 is required"

else if dict("Field1")="B" and dict("Field3")="" then

Response.Write "Field3 is required"

end if
F
funkfish author 9/17/2007

Sure, you can use BeforeAdd/BeforeEdit event to implement this logic.


if dict("Field1")="A" and dict("Field2")="" then

Response.Write "Field2 is required"

else if dict("Field1")="B" and dict("Field3")="" then

Response.Write "Field3 is required"

end if


Thanks for the response. What I'm actually looking for is the following:
There are 4 categories to select from intially and depending on which of the 4 is selected the user will be given other field to fill which will become mandatory.

Example, Initial field = A, B, C or D

If A then fill out Field1, Field2, Field3

If B then fill out Field4, Field5

If C then fill out Field6, Field7, Field8, Field9

If D then fill out Field10, Field11
Keep in mind that Fields1-11(or more) vary in type of input - drop down, textbox, etc.
I hope this makes sense and is achievable using the tools within PHPRunner.
Many thanks!

Sergey Kornilov admin 9/17/2007

This is an ASPRunnerPro forum.