Brad
|
| Posted: 08/28/2002, 7:05 AM |
|
CC 2.0.5
Asp 2.0 & Templates
MS Access DB
Question:
How do you make one field required based on the conditional value of another field?
I don't know VB, but here is the logic I am looking for.
Logical Example:
If fldStatus = "Complete" then
fldDateFinished is a required field
|
|
|
 |
Vince
|
| Posted: 08/28/2002, 7:42 AM |
|
I have done this with PHP so I guess you could translate this to ASP.
You need to do some editing. Go to form properties, Custom Action. Click on "obtain generated code" and it the section 'Validate fields', put the following:
if($fldstatus == "Complete")
{
if(!strlen($fldDateFinished ))
$sFORMNAMEErr .= "The value in field DateFinished is required.";
if(strlen($sFORMNAMEErr)) return;
}
else if($fldstatus <> "Complete")
{
if(strlen($sFORMNAMEErr)) return;
}
Hope it helps.
Vince
|
|
|
 |
Brad
|
| Posted: 08/28/2002, 10:23 AM |
|
Thank you for your help Vince, but what I am missing is the VB for ASP. If anyone could help me with this I would greatly appreciate it.
Thanks in advance
Brad
|
|
|
 |
Nicole
|
| Posted: 08/29/2002, 1:31 AM |
|
Brad,
here is sample asp code. Put it into form Validation event:
if CStr(fldstatus) = "Complete" then
if not len(fldDateFinished) then
sFORMNAMEErr = sFORMNAMEErr & "The value in field DateFinished is required."
end if
end if
|
|
|
 |
Brad
|
| Posted: 08/29/2002, 7:17 AM |
|
Nicole, you are a beautiful woman! Thank you so much for your help!
An extremely grateful Brad
|
|
|
 |