Subject Re:
From Mervyn Bick <invalid@invalid.invald>
Date Mon, 5 Nov 2018 09:10:52 +0200
Newsgroups dbase.getting-started

On 2018-11-05 2:47 AM, Charlie wrote:
> I came across something strange with this custom form (  Although it could be something I did or have done wrong, I am not sure.
> OK the code I am using to verify a password is:
> cPass = trim(form.PasswordMaskEF1.enteredPassword)
>                 if cpass = trim(form.users1.rowset.fields["pass"].value)
>                 msgbox( cpass+" "+form.users1.rowset.fields["pass"].value )//test messagebox
>                   do menum.wfm
>                   form.close()
>                 else
>                   msgbox('Sorry wrong password.','Error')
>                   msgbox( cpass+" "+form.users1.rowset.fields["pass"].value )//test messagebox
>                   form.passwordmaskef1.value = ""
>                   form.passwordmaskef1.setfocus()
>                 endif
> I used a couple of message boxes to verify what I am finding.
> Say the actual password in the table is test.  If you type in 'test' of course the program opens correctly.  If you type something like 'fejjeij'  the password doesn't work and you get the sorry message.
> But if you type in 'test11111'  the password passes.  So any characters after the password seem to be completely ignored.
> The test message boxes confirm that both strings are exactly the same or not the same.
> I thought possibly there was some property that I was missing like exact or something, but that doesn't seem to be the case.
> I am wondering if something is wrong with my code or possibly this is a constant problem with the custom form?

It depends on the setting for EXACT. You can easily test the setting by
? set("exact") in the Command Panel.

If EXACT is set off (which is the default) one can think of 'cPass =
trim(form.users1.rowset.fields["pass"].value)' as meaning 'cPass BEGINS
WITH trim(form.users1.rowset.fields["pass"].value)'.

In other words if cPass = 'test1111' and
form.users1.rowset.fields["pass"].value = 'test' the comparison is going
to return TRUE if EXACT is off as 'test1111' does begin with 'test'

Instead of messing around with the setting of EXACT it is simpler to use
the == operator for the comparison as Ken has suggested.  This forces an
exact comparison irrespective of the setting for EXACT.

= serves double duty as either an assignment operator or a comparison
operator. == is purely a comparison operator.

To place the value of trim(form.PasswordMaskEF1.enteredPassword) in
cPass you may only use =  Using == here will give you an error.