craftleft.gif (3002 bytes)QuickTable
Home | API | Tutorial | Download | Support | Contact topblack.gif (108 bytes)


QuickTable User Cp  |  Register  |  Members  |  Search  |  Help
    |- QuickTable Discussion Forums > Events/Actions Post New Topic   Post A Reply
Issue with Record Level Validation printer friendly version
next newest post | next oldest post
Author Messages
Ron Troyer
Private First Class

Gender: Unspecified
Location:
Registered: Oct 2004
Status: Offline
Posts: 12

Click here to see the profile for Ron Troyer Send email to Ron Troyer Find more posts by Ron Troyer Edit or delete this message Reply w/Quote
Posted Saturday, February 5, 2005 @ 17:44:39  

I am trying to validate the values in a record before an attempt is made to insert the reocrd into the database. I have put the validation check in the beforeInsert method, because this is a record level validation. The problem I am seeing is that once I return a false (indicating validation failure), the bean never tries to insert the record again. Therefore, it is possible to enter data, and believe it has been written to the database, but it has not been written. The only thing I can assume is that once the false is return from the beforeInsert method, the quicktable assumes that I do not wish it to try again. Now the question are as follows: Is there another place to put the record level validation? Is there a function call to tell the been, I want it to try again? Or, is there another way to approach this all together.

Code:


public boolean beforeInsert( int row ) {
if ( IssuesTable.getValueAt( row, 1 ).equals( "" ) ) {
return false;
}
Timestamp now = new Timestamp( System.currentTimeMillis() );
IssuesTable.setValueAt( now, row, issuesDateCreatedCol );
IssuesTable.setValueAt( now, row, issuesDateUpdatedCol );
IssuesTable.setValueAt( Periodicals.UserId, row, issuesCreatedByCol );
IssuesTable.setValueAt( Periodicals.UserId, row, issuesUpdatedByCol );
return true;
}

Regards
Ron Troyer

Admin
Board Owner

Gender: Unspecified
Location:
Registered: Jul 2003
Status: Offline
Posts: 9

Click here to see the profile for Admin Send email to Admin Send private message to Admin Find more posts by Admin Edit or delete this message Reply w/Quote
Posted Monday, February 7, 2005 @ 00:22:51  

The api documentation says that, if you return false for beforeInsert() method, then that means you have handled the insert yourself and you do not want quicktable to handle the insert. So it is working as expected. Additionally quicktable provides one more property to override this behaviour, which is postponeDBInsert.

dbtable.postponeDBInsert = true

If you set this property to true, then if you return false for beforeInsert, it will postpone the insert until you return true for beforeInsert for that particular record.

Ron Troyer
Private First Class

Gender: Unspecified
Location:
Registered: Oct 2004
Status: Offline
Posts: 12

Click here to see the profile for Ron Troyer Send email to Ron Troyer Find more posts by Ron Troyer Edit or delete this message Reply w/Quote
Posted Tuesday, February 8, 2005 @ 00:14:06  

Thanks -- That did the trick
Post New Topic   Post A Reply Jump to:
Contact Us | QuickTable - A Java DBGrid | Privacy Policy All times are GMT -5 Hours.
Welcome to QuickTable Forums, Guest!  
Login
Username :
Password :
In order to fully utilize the abilities of this board, you are required to register as a member. Registration is free, and allows you to do lots of things including turning on or off certain features of this board. Register now!
Powered by CuteCast v2.0 BETA 2
Copyright © 2001-2003 ArtsCore Studios