![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have a field in a table which is set as a number field. The user can only insert whole numbers such as 1 or a decimal such as .5 (the user can also do 1.5 etc..) THere are only certain decimals which are allowed and I have a method which checks that. Not a problem. I am concerned that the user might try to insert a fraction such as "1/2". I would like to trap for that PRIOR to the method which checks for the proper decimals which is triggered in changevalue. How can I trap for that? Thanks in advance, Craig |
#3
| |||
| |||
|
|
I am concerned that the user might try to insert a fraction such as "1/2". |
|
I have a field in a table which is set as a number field. The user can only insert whole numbers such as 1 or a decimal such as .5 (the user can also do 1.5 etc..) THere are only certain decimals which are allowed and I have a method which checks that. Not a problem. I am concerned that the user might try to insert a fraction such as "1/2". I would like to trap for that PRIOR to the method which checks for the proper decimals which is triggered in changevalue. How can I trap for that? Thanks in advance, Craig |
#4
| |||
| |||
|
|
I have a field in a table which is set as a number field. The user can only insert whole numbers such as 1 or a decimal such as .5 (the user can also do 1.5 etc..) THere are only certain decimals which are allowed and I have a method which checks that. Not a problem. I am concerned that the user might try to insert a fraction such as "1/2". I would like to trap for that PRIOR to the method which checks for the proper decimals which is triggered in changevalue. How can I trap for that? Thanks in advance, Craig |
#5
| |||
| |||
|
|
I have a field in a table which is set as a number field. |
#6
| |||
| |||
|
|
Craig, I have a field in a table which is set as a number field. Assuming you mean that you have a form with the field, then you can check what is entered by the field's keyChar() method. For example (untested of course): method keyChar(var eventInfo KeyEvent) curChar = eventInfo.char() if curChar >= "0" and curChar <= "9" then else ; check for multiple '.' if curChar = ".' then oldVal = self.value if oldVal.search(".") > 0 then disableDefault eventInfo.setErrorCode(canNotDepart) msgStop("Error","Only one decimal allowed") return endif else disableDefault eventInfo.setErrorCode(canNotDepart) msgStop("Error","Invalid digit") return endif endif doDefault endMethod |
#7
| |||
| |||
|
|
Is it possible to intercept that message so I can make it more noticeable? |
#8
| |||
| |||
|
|
Perhaps a trap in the field's error event: if eventInfo.errorCode() = peNoPictureMatch then msgStop("Hey","Bad Doctor!") endIf Liz "Craig" <craig.futterman (AT) nospam (DOT) comcast.net> wrote: Is it possible to intercept that message so I can make it more noticeable? |
#9
| |||
| |||
|
|
Liz, Fantastic! That worked. Is there a list of all these errorcodes anywhere? Thanks again, Craig |
#10
| |||
| |||
|
|
ProView has a shortcut for listing RTL Errors. I used that. There are methods in ObjectPAL to list RTL errors, methods, constants, etc. Liz Craig wrote: Liz, Fantastic! That worked. Is there a list of all these errorcodes anywhere? Thanks again, Craig |
![]() |
| Thread Tools | |
| Display Modes | |
| |