Validation Question and inline bindings again
Validation Question and inline bindings again
- Subject: Validation Question and inline bindings again
- From: "Chan Yeow Heong, Jerome" <email@hidden>
- Date: Wed, 09 Sep 2009 01:49:40 +0800
I override validationFailedWithException to catch the (throwable t
Object value String keyPath) and store them into a page level
NSMutableDictionary using keyPath as the key and a custom class to
hold the variables t and value. This custom class has isError (returns
a true if the keyPath exists and false if it doesn't], message (which
is just the exception.getMessage result) and class (which returns a
css class based on if there is an error or not for that attribute).
This error dictionary is named validationError.
I'd like to be able to do
<p>
<label>Account</label>
<wo:WOConditional condition = "$errDictionary.xxx.isError">
<wo:String value = "$errDictionary.xxx.message">
</wo:WOConditional>
<wo:WOTextField value = "$selectedUser.accountName" class =
"$errDictionary.xxx.class"/>
</p>
What do I put in xxx? The keypath I get is
'selectedAccount.accountName'.
UPDATE:
After some experiments I found the following works:
"~validationError()[\"selectedUser.accountName\"].isError()"
"~validationError()[\"selectedUser.accountName\"].message()"
"~validationError()[\"selectedUser.accountName\"].class()"
And to access a static field in a class is
"~@com.tofusoft.utils.State@SEARCH"
WHEEEEEEEEEEEEEEEEEEEEEE!
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden