Jan K. van Dalen
|
Posted: 01/08/2008, 2:05 PM |
|
Ok, I have a text box named "UserCode".
I entered this in the validation rule box: len(trim(UserCode.Value)) < 4
It is not working. What I want is a message that if the UserCode is less
than 4 characters, that they will receive an error message. UserCode is a
varchar(10) field.
Any ideas?
|
|
|
zolw
Posts: 51
|
Posted: 01/08/2008, 5:28 PM |
|
Why don't you validate in real time with Javascript?
_________________
Zolw
http://www.xlso.com |
|
|
Edigital
Posts: 5
|
Posted: 05/04/2008, 3:58 AM |
|
I think you should include form name in validation, and condition when entry is true...
For example: len(trim((myrecordformname.myfieldname.value))) > 3
e.g (len(trim((User.UserCode.value))) > 3
Regards!
_________________
----------just learning!! |
|
|
wkempees
|
Posted: 05/04/2008, 5:01 AM |
|
Validate Minimum Length
Is an action in itself
Walter
"Jan K. van Dalen" <jan@windmilltechnology.com> schreef in bericht
news:fm0s3o$i2n$1@news.codecharge.com...
> Ok, I have a text box named "UserCode".
>
> I entered this in the validation rule box: len(trim(UserCode.Value)) < 4
>
> It is not working. What I want is a message that if the UserCode is less
> than 4 characters, that they will receive an error message. UserCode is a
> varchar(10) field.
>
> Any ideas?
>
|
|
|
DaveSause
Posts: 14
|
Posted: 05/07/2008, 11:35 AM |
|
OK guys, this sounds like Access. I haven't figured out how to validate in code charge.
In Access, however, you can't use the field to validate itself, this is a circular reference so =len(trim$(fieldname))>4 is not a legal validation for fieldname.
You might try event in CodeCharge, like "before insert" or "before update".
Then the syntax is fldfieldname = left$(fldfieldname, 4) which cuts it to four characters.
You seem to need some test of the length and a branch in code, so far, whatever CodeCharge accepts get's passed to the database, wrong or right. This will prevent the update/insert from happening if the database also detects bad data.
Try this:
while len(fldfieldname) > 4 'no need to trim, CodeCharge does that automatically'
response.write "Fieldname has a maximum length of four characters"
exit sub
wend
Dave
_________________
Dave Sause |
|
|
DaveSause
Posts: 14
|
Posted: 05/07/2008, 11:35 AM |
|
OK guys, this sounds like Access. I haven't figured out how to validate in code charge.
In Access, however, you can't use the field to validate itself, this is a circular reference so =len(trim$(fieldname))>4 is not a legal validation for fieldname.
You might try event in CodeCharge, like "before insert" or "before update".
Then the syntax is fldfieldname = left$(fldfieldname, 4) which cuts it to four characters.
You seem to need some test of the length and a branch in code, so far, whatever CodeCharge accepts get's passed to the database, wrong or right. This will prevent the update/insert from happening if the database also detects bad data.
Try this:
while len(fldfieldname) > 4 'no need to trim, CodeCharge does that automatically'
response.write "Fieldname has a maximum length of four characters"
exit sub
wend
Dave
_________________
Dave Sause |
|
|
DaveSause
Posts: 14
|
Posted: 05/07/2008, 11:35 AM |
|
OK guys, this sounds like Access. I haven't figured out how to validate in code charge.
In Access, however, you can't use the field to validate itself, this is a circular reference so =len(trim$(fieldname))>4 is not a legal validation for fieldname.
You might try event in CodeCharge, like "before insert" or "before update".
Then the syntax is fldfieldname = left$(fldfieldname, 4) which cuts it to four characters.
You seem to need some test of the length and a branch in code, so far, whatever CodeCharge accepts get's passed to the database, wrong or right. This will prevent the update/insert from happening if the database also detects bad data.
Try this:
while len(fldfieldname) > 4 'no need to trim, CodeCharge does that automatically'
response.write "Fieldname has a maximum length of four characters"
exit sub
wend
Dave
_________________
Dave Sause |
|
|
DaveSause
Posts: 14
|
Posted: 05/07/2008, 11:35 AM |
|
OK guys, this sounds like Access. I haven't figured out how to validate in code charge.
In Access, however, you can't use the field to validate itself, this is a circular reference so =len(trim$(fieldname))>4 is not a legal validation for fieldname.
You might try event in CodeCharge, like "before insert" or "before update".
Then the syntax is fldfieldname = left$(fldfieldname, 4) which cuts it to four characters.
You seem to need some test of the length and a branch in code, so far, whatever CodeCharge accepts get's passed to the database, wrong or right. This will prevent the update/insert from happening if the database also detects bad data.
Try this:
while len(fldfieldname) > 4 'no need to trim, CodeCharge does that automatically'
response.write "Fieldname has a maximum length of four characters"
exit sub
wend
Dave
_________________
Dave Sause |
|
|
wkempees
Posts: 1679
|
Posted: 05/08/2008, 3:54 AM |
|
Am I mistaken?
@Jan
Your objective is to test the user to enter data in a textbox and the data must be at least 4 postition in length?
In Designer, properties of the field, onValidate add action from the available actions.
Action: ValidateMinimumLength, set it to 4.
Walter
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)
if you liked this info PAYPAL me: http://donate.consultair.eu
|
|
|
|