Home > Archive > Programming with dBASE > December 2005 > valid question









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author valid question
Charlie Lutz

2005-12-08, 1:23 pm

The following code is part of the valid event for an entryfield.
If the field is not blank, ask the user if the country is outside the
US, if not, we want the field to be empty.

The no answer to the message box works as expected,
the problem is, even if the user clicks the yes button in the message
box, the entered value in the entry field is cleared and focus moves to
the next entry field. For some reason it does not keep the entered
data, even when it is valid.

What am I missing?

Thanks,
Charlie

function EFCOUNTRY_valid
local lRet, nAns
lRet = true
if not empty(this.value)
nAns = msgbox("Is this address outside the United States?",
"Non USA address",36)
if nAns = 7 // no
this.validErrorMsg :="Please leave the country entryfield
blank if this is a US address"
lRet = false
else
lRet = true
endif
else
lRet = true
endif

return lRet

--


____________________
________
Charlie Lutz
#1000441
Frank J. Polan

2005-12-08, 1:23 pm

Charlie

Is the entryfield datalinked ?

When not datalinked it works as expected for me
If datalinked to a blank field it clears the entryfield

I think you need to break the datalink and do something like the
following if you want to save the value

else
form.rowset.fields['field2'].value :=
form.entryfield1.value
form.rowset.save()
lRet = true
endif

HTH

Frank Polan



On Thu, 8 Dec 2005 11:24:44 -0600, Charlie Lutz
<lutzc@(remove)wes.army.mil> wrote:

>
>The following code is part of the valid event for an entryfield.
>If the field is not blank, ask the user if the country is outside the
>US, if not, we want the field to be empty.
>
>The no answer to the message box works as expected,
>the problem is, even if the user clicks the yes button in the message
>box, the entered value in the entry field is cleared and focus moves to
>the next entry field. For some reason it does not keep the entered
>data, even when it is valid.
>
>What am I missing?
>
>Thanks,
>Charlie
>
>function EFCOUNTRY_valid
> local lRet, nAns
> lRet = true
> if not empty(this.value)
> nAns = msgbox("Is this address outside the United States?",
>"Non USA address",36)
> if nAns = 7 // no
> this.validErrorMsg :="Please leave the country entryfield
>blank if this is a US address"
> lRet = false
> else
> lRet = true
> endif
> else
> lRet = true
> endif
>
> return lRet



Charlie Lutz

2005-12-09, 9:23 am

In article < 8dugp1d8b6be1qmisa8l
l99h73k9qdn35r@4ax.com>,
fpolan@pcassist.on.ca says...
> Charlie
>
> Is the entryfield datalinked ?
>
> When not datalinked it works as expected for me

Frank,
Yes the entryfield is datalinked. With your explanation I will try a
couple of things to see how I can best make it work.
I wonder why firing the valid event prevents the entryfield from keeping
the entered data when return is true? Seems like to me, that if return
is true, things should act "normal".

Thanks
Charlie
--


____________________
________
Charlie Lutz
#1000441
Frank J. Polan

2005-12-09, 9:23 am

Charlie,

I agree - it doesn't seem to be working as it should. It seems to be
related to the MSGBOX(). If you remove the msgbox, the valid seems to
work - but then you can't use the function as you want it

Frank Polan


On Fri, 9 Dec 2005 07:47:47 -0600, Charlie Lutz
<lutzc@(remove)wes.army.mil> wrote:

>
>In article < 8dugp1d8b6be1qmisa8l
l99h73k9qdn35r@4ax.com>,
>fpolan@pcassist.on.ca says...
>Frank,
>Yes the entryfield is datalinked. With your explanation I will try a
>couple of things to see how I can best make it work.
>I wonder why firing the valid event prevents the entryfield from keeping
>the entered data when return is true? Seems like to me, that if return
>is true, things should act "normal".
>
>Thanks
>Charlie



Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com