Validate get
Validate get
REDEFINE GET oSS_Num VAR cSS_Num ID 2103 of oFld:aDialogs[GenFldr] ;
Picture "@R ###-##-####" ;
valid ( !empty(cSS_Num ) ) ;
UPDATE
Need to be sure that the user can't save a blank value to cSS_Num. This used to work just fine in earlier versions of my system before I upgraded FWH/Harbour.
Is there a better way of testing for an empty field? I've oSS_Num:VarGet() and oSS_Num:Value() both methods test as empty.
Picture "@R ###-##-####" ;
valid ( !empty(cSS_Num ) ) ;
UPDATE
Need to be sure that the user can't save a blank value to cSS_Num. This used to work just fine in earlier versions of my system before I upgraded FWH/Harbour.
Is there a better way of testing for an empty field? I've oSS_Num:VarGet() and oSS_Num:Value() both methods test as empty.
- Rick Lipkin
- Posts: 2397
- Joined: Fri Oct 07, 2005 1:50 pm
- Location: Columbia, South Carolina USA
Re: Validate get
Don
I would do your validation this way .. gives you more options ..
Rick Lipkin
I would do your validation this way .. gives you more options ..
Rick Lipkin
Code: Select all
REDEFINE GET oSS_Num VAR cSS_Num ID 2103 of oFld:aDialogs[GenFldr] ;
Picture "@R ###-##-####" ;
valid ( _ChkSsn( cSs_num,oSs_num )) UPDATE
//--------------
Static Func _ChkSsn( cSs_num,oSsn_num )
Local Saying
If empty( cSs_num ) .or. cSs_num = " "
Saying := "SSN is a Required field"
MsgInfo( Saying )
oSs_num:SetFocus()
Return(.f.)
Endif
Return(.t.)
Re: Validate get
I did a poor job of describing my problem.
Since upgrading the FWH\Harbour the valid statement always finds cSS_Num empty, regardless of whatever the user may enter.
Since upgrading the FWH\Harbour the valid statement always finds cSS_Num empty, regardless of whatever the user may enter.
Re: Validate get
VALID ( if (empty(cSS_Num ) , .F., .T. )) ;DonDrew wrote:REDEFINE GET oSS_Num VAR cSS_Num ID 2103 of oFld:aDialogs[GenFldr] ;
Picture "@R ###-##-####" ;
valid ( !empty(cSS_Num ) ) ;
UPDATE
Need to be sure that the user can't save a blank value to cSS_Num. This used to work just fine in earlier versions of my system before I upgraded FWH/Harbour.
Is there a better way of testing for an empty field? I've oSS_Num:VarGet() and oSS_Num:Value() both methods test as empty.
So I work my
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
- FranciscoA
- Posts: 1964
- Joined: Fri Jul 18, 2008 1:24 am
- Location: Chinandega, Nicaragua, C.A.
Re: Validate get
Hi,
I do the same as Mr. Rick, with something more:
The more secure method I have found to validate gets, it's when you press the "Accept" button, of the dialogue.
Why?, because if you have 3 gets, for example, and the user clicks the "Accept" button while him is in the second get, el third will be not evaluated.
Regards.
I do the same as Mr. Rick, with something more:
The more secure method I have found to validate gets, it's when you press the "Accept" button, of the dialogue.
Why?, because if you have 3 gets, for example, and the user clicks the "Accept" button while him is in the second get, el third will be not evaluated.
Regards.
Francisco J. Alegría P.
Chinandega, Nicaragua.
Fwxh1204-MySql-TMySql
Chinandega, Nicaragua.
Fwxh1204-MySql-TMySql
Re: Validate get
valid ( empty(cSS_Num ) )
valid ( if(empty(cSS_Num ),.F.,.T.) )
Both versions return False regardless of what may be entered by the user.
valid ( if(empty(cSS_Num ),.F.,.T.) )
Both versions return False regardless of what may be entered by the user.
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Validate get
Don,
What FWH version are you using ?
What FWH version are you using ?
Re: Validate get
Hi, Antonio.
FWH Ver 13.03
I found the solution this morning.
These did not work:
valid( !empty(cSS_NUM) )
valid( !empty(oSS_Num:Value()) )
This DID work:
oSS_Num:bvalid := { !empty(oSS_Num:Value()) }
FWH Ver 13.03
I found the solution this morning.
These did not work:
valid( !empty(cSS_NUM) )
valid( !empty(oSS_Num:Value()) )
This DID work:
oSS_Num:bvalid := { !empty(oSS_Num:Value()) }
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: Validate get
This is working for me:
The get is validated when the focus is moved from the get object to another control of the dialog. The above program is working correctly as expected.
Get validation is not executed when there is only one get on the dialog.
The original code in the first posting should work as it is and as expected if there is another control on the dialog.
Code: Select all
#include "fivewin.ch"
function Main()
local cVar := Space( 8 )
local oGet
local oDlg
DEFINE DIALOG odlg
@ 10,10 GET oGet VAR cVar PICTURE "@R ###-##-###" SIZE 50,12 PIXEL OF oDlg ;
VALID !Empty( cVar )
@ 25,10 BUTTON "ok" SIZE 30,14 PIXEL OF oDlg
ACTIVATE DIALOG oDlg CENTERED
? cVar
return nil
Get validation is not executed when there is only one get on the dialog.
The original code in the first posting should work as it is and as expected if there is another control on the dialog.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: Validate get
There are 19 controls on this one dialog.
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: Validate get
#1. Can you please compile and test the small program I posted and give your feedback if that is working as expected?DonDrew wrote:There are 19 controls on this one dialog.
#2. Then if you still have problem, please post a small sample to reproduce your problem. A complete sample that we can compile and test at our end here. That will greatly help us to help you.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India