Ok, here's an example that actually works (and forget my pervious post).
It gets validated if you use a space in there, uppercase letters or let
the field be blank, but not lowercase or numbers
import dabo
dabo.ui.loadUI("wx")
from dabo.db import dConnectInfo
from dabo.biz import dBizobj
class TestBiz(dBizobj):
def initProperties(self):
self.DataSource = "tbl_test"
self.KeyField = "textfield"
def afterInit(self):
self.setFromClause("tbl_test")
def validateField(self, fld, val):
errmsg = ""
if fld == "textfield":
errmsg += "Something in textfield"
return errmsg
class TestForm(dabo.ui.dForm):
def afterInit(self):
conn = self.Application.getConnectionByName("testdb")
biz = TestBiz(conn)
self.addBizobj(biz)
self.requery()
panel = dabo.ui.dPanel(self)
self.Sizer.append1x(panel)
panel.Sizer = dabo.ui.dSizer()
txt = dabo.ui.dTextBox(panel)
txt.DataSource = "tbl_test"
txt.DataField = "textfield"
txt.ForceCase = "lower"
txt2 = dabo.ui.dTextBox(panel)
txt2.Value = "blah"
panel.Sizer.appendItems([txt, txt2])
app = dabo.dApp()
app.addConnectInfo(dConnectInfo({"dbtype":"SQLite","name":"testdb",
"database":"testdb"}))
conn = app.getConnectionByName("testdb")
crs = conn.getDaboCursor()
try:
crs.execute("CREATE TABLE tbl_test (textfield VARCHAR(50))")
except dabo.dException.DBQueryException:
pass
crs.execute("INSERT INTO tbl_test VALUES('yeah')")
conn.getBackendObject().commitTransaction(crs)
app.MainFormClass = TestForm
app.setup()
app.start()
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Simen Haugen
Sent: 25. september 2006 16:47
To: Dabo Users list
Subject: RE: [dabo-users] dTextBox.ForceCase bug.
When trying to leave the first control after adding an uppercase letter,
I get the following error:
Dabo Error Log: Mon Sep 25 16:44:10 2006: Could not bind to
'tbl_test.textfield'
import dabo
dabo.ui.loadUI("wx")
from dabo.db import dConnectInfo
from dabo.biz import dBizobj
class TestBiz(dBizobj):
def afterInit(self):
self.DataSource = "tbl_test"
self.setFromClause("tbl_test")
def fieldValidation(self, fld, val):
if fld == "textfield":
errmsg += "Something in textfield"
return errmsg
class TestForm(dabo.ui.dForm):
def afterInit(self):
panel = dabo.ui.dPanel(self)
self.Sizer.append1x(panel)
panel.Sizer = dabo.ui.dSizer()
txt = dabo.ui.dTextBox(panel)
txt.DataSource = "tbl_test"
txt.DataField = "textfield"
txt.ForceCase = "lower"
txt2 = dabo.ui.dTextBox(panel)
txt2.Value = "blah"
panel.Sizer.appendItems([txt, txt2])
app = dabo.dApp()
app.MainFormClass = TestForm
app.setup()
app.addConnectInfo(dConnectInfo({"dbtype":"SQLite","name":"testdb",
"database":"testdb"}))
conn = app.getConnectionByName("testdb")
crs = conn.getDaboCursor()
try:
crs.execute("CREATE TABLE tbl_test (textfield VARCHAR(50))")
except dabo.dException.DBQueryException:
pass
app.start()
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Ed Leafe
Sent: 25. september 2006 00:54
To: Dabo Users list
Subject: Re: [dabo-users] dTextBox.ForceCase bug.
On Sep 22, 2006, at 12:06 PM, Simen Haugen wrote:
> When setting ForceCase on a textbox, the bizobjs fieldvalidation
> doesn't
> work right.
>
> I had ForceCase to "lower", but then fieldvalidation didn't get called
> (unless I had a space in there).
Sorry for the delay, but I'm finally getting around to testing
this.
I don't see the problem you describe. If I have ForceCase set
for a
control, it fires before the form-level field validation is called
(as it should), and both methods are getting called. Can you post an
issue with the .cdxml file or the code used that will reproduce the
problem?
-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users