CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 Required Field on Condition

Print topic Send  topic

Author Message
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

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.