CodeCharge Studio
search Register Login  

Web Reports

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

YesSoftware Forums -> CodeCharge Studio -> ASP

 Validate Text Box

Print topic Send  topic

Author Message
Darren O'Meara
Posted: 03/01/2004, 1:47 PM

I would like to validate one text box entry against another. The validation
process is that if an account is entered a check is made to see if it it
valid against a cost centre.

I have two columns Account & Centre. There is only one cost centre present
but several accounts attached to the same cost centre. For example

Account Centre
0101 25050
0102 25050
0103 25050
etc....

What I would like to do is perform a validation check to ensure that if the
account 0101 is entered and the corresponding centre is present, which in
this case is 25050 the record is valid and entered into the table. If
however, the account and cost centre combination does not match an error is
presented to the user which forces them to correct the entry.

Is this possible.

Any help would be fantastic.

DonB
Posted: 03/02/2004, 7:18 AM

First we need to know what "match" means. Is there a table of pairs
(Account, Centre) that you compare against? If so, why not provide a
listbox of these pairs so they don't have to be typed in? Then you don't
need to worry about extra validation code.

You can fill the listbox with values from a SQL statement like: SELECT
someID, Account + '/' + Centre as picklist FROM sometable to display the
pairs as text "aaa/bbb" and pick the value of someID which designates the
unique primary key referencing the pair.

If you choose not to go that route, then the OnValidate events can be
defined to lookup the "other" value:

With Eventcaller
If CCDlookup("Centre", "sometable", "somekey=" & .Account.Value,
someconnectionobject) = "" Then
.Eventcaller.Errors.Add "No matching Account exists for the Centre")
End If
End With

Note that this is a very primative example code that probably is not going
to just drop in and work - I definitely did not test it. It's just to give
you an idea how to approach validation. There is (for one thing) an issue
with trying to validate both controls this way, at the same time. The users
will probably hate you for making them guess at valid combinations of
Account/Centre until they get it right.
--
DonB

http://www.gotodon.com/ccbth


"Darren O'Meara" <darrenomeara@blueyonder.co.uk> wrote in message
news:c20b2d$j2a$1@news.codecharge.com...
> I would like to validate one text box entry against another. The
validation
> process is that if an account is entered a check is made to see if it it
> valid against a cost centre.
>
> I have two columns Account & Centre. There is only one cost centre
present
> but several accounts attached to the same cost centre. For example
>
> Account Centre
> 0101 25050
> 0102 25050
> 0103 25050
> etc....
>
> What I would like to do is perform a validation check to ensure that if
the
> account 0101 is entered and the corresponding centre is present, which in
> this case is 25050 the record is valid and entered into the table. If
> however, the account and cost centre combination does not match an error
is
> presented to the user which forces them to correct the entry.
>
> Is this possible.
>
> Any help would be fantastic.
>
>


Add new topic Subscribe to topic   


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

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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