Ive been all over the manual, through all the examples, but cannot find out how to validate an entry in a bbrowser object.
All I want to achieve is if the user enters a value larger than another display a warning box.
Specifically if _Field->AMTPAID > _FIELD->INVGT. In other words, they paid more than the invoice total, spit out a warning box.
Can someone please enlighten me?
Data validation in bBrowser
- Joachim Bieler
- Posts: 37
- Joined: Mon Aug 19, 2019 1:51 pm
- Location: Germany
Data validation in bBrowser
You can use the callback method CellEdit() to validate values during a cell edit process. The method CellEdit() is called automatically by the bBrowser in the owner of it. The method is passed an object of class bCellEditEvent. A validation of the edit value would be possible for example if the access bCellEditEvent:EditMode has the value BEDIT_END. You find an example for this in the sample application 'bSample - Edit.aef'. Please have a look in method dtwEditDBStruct:CellEdit().
Regards,
Joachim
Regards,
Joachim
Data validation in bBrowser
Thanks Joachim, I've tried that, from the sample file, it works, but not instantly. If the value is 0.00 then I enter 700.00 (which is over the limit and should trigger it) it doesn't flag the message until after I've REENTERED the field a second time...
- Joachim Bieler
- Posts: 37
- Joined: Mon Aug 19, 2019 1:51 pm
- Location: Germany
Data validation in bBrowser
I'm sorry, but I have no idea what the problem might be. Please send me a Test-Application (as source code) with that I can reproduce the problem. The easiest way to do this is to use the sample application 'bSample - CellEdit.aef' and adapt it in such a way that the problem occurs.
Which version of bBrowser do you use?
Regards,
Joachim
Which version of bBrowser do you use?
Regards,
Joachim
Data validation in bBrowser
Ok, ill try that, thank ypu Joachim. I use bbrowser 4 for VO Pro with source code Can't say I've seen celledit.aef is it part of the install?
- Joachim Bieler
- Posts: 37
- Joined: Mon Aug 19, 2019 1:51 pm
- Location: Germany
Data validation in bBrowser
Sorry, I mean 'bSample - Edit.aef'.
Regards,
Joachim
Regards,
Joachim
Data validation in bBrowser
Ah, OK, so I'm not 100% mad then! <g> To be honest I deleted all the code I'd tried before, and it's 12:45 (almost) in the morning, but this is where it sits atm:
method CellEdit(oEvent) class AInvReceiptWin
// callback method for cell edit
local oColumn as bDataColumn
Local cText
// evaluate edit mode
if oEvent:EditMode=BEDIT_CREATE
// create special edit controls
oColumn := oEvent:Control:GetOpenColumn(oEvent:EditCell:Column)
if oColumn:ValType="D"
oEvent:EditControl := oEvent:Control:EditCreate(oEvent:EditCell:Column, oEvent:EditCell:Row, oEvent:EditCell:RecNo, #DateTimePicker)
endif
endif
/* if oEvent:EditMode=BEDIT_END
// close edit
oColumn := oEvent:Control:GetOpenColumn(oEvent:EditCell:Column)
if oColumn:FieldSym=#AMTPAID
// column NAME
// check field name
cField :=oEvent:EditControl:Value
// search field name in server
oasServer := self:oDCBrowser1:Server
oasServer:SuspendNotification()
iRecNo := oasServer:RecNo */
return nil
method CellEdit(oEvent) class AInvReceiptWin
// callback method for cell edit
local oColumn as bDataColumn
Local cText
// evaluate edit mode
if oEvent:EditMode=BEDIT_CREATE
// create special edit controls
oColumn := oEvent:Control:GetOpenColumn(oEvent:EditCell:Column)
if oColumn:ValType="D"
oEvent:EditControl := oEvent:Control:EditCreate(oEvent:EditCell:Column, oEvent:EditCell:Row, oEvent:EditCell:RecNo, #DateTimePicker)
endif
endif
/* if oEvent:EditMode=BEDIT_END
// close edit
oColumn := oEvent:Control:GetOpenColumn(oEvent:EditCell:Column)
if oColumn:FieldSym=#AMTPAID
// column NAME
// check field name
cField :=oEvent:EditControl:Value
// search field name in server
oasServer := self:oDCBrowser1:Server
oasServer:SuspendNotification()
iRecNo := oasServer:RecNo */
return nil