Page 1 of 1
Data validation in bBrowser
Posted: Mon Dec 30, 2019 8:42 am
by Anonymous
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
Posted: Mon Dec 30, 2019 12:10 pm
by Joachim Bieler
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
Data validation in bBrowser
Posted: Mon Dec 30, 2019 12:21 pm
by BiggyRat
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...
Data validation in bBrowser
Posted: Mon Dec 30, 2019 12:52 pm
by Joachim Bieler
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
Data validation in bBrowser
Posted: Mon Dec 30, 2019 1:00 pm
by BiggyRat
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?
Data validation in bBrowser
Posted: Mon Dec 30, 2019 1:23 pm
by Joachim Bieler
Sorry, I mean 'bSample - Edit.aef'.
Regards,
Joachim
Data validation in bBrowser
Posted: Mon Dec 30, 2019 1:38 pm
by BiggyRat
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
Data validation in bBrowser
Posted: Tue Dec 31, 2019 6:04 am
by BiggyRat
Got it! Thanks very much Joachim for the pointers!