Help with Universal Form...
Help with Universal Form...
- Subject: Help with Universal Form...
- From: LD <email@hidden>
- Date: Tue, 23 Aug 2005 14:01:18 +1000
Hi there,
I'm trying to build a re-usable form component that will utilise a
component action or direct action (decided via a boolean value such
as hasSession) but I'm getting run-time exceptions, however. (I'm
trying to avoid creating duplicate portions of the page just because
it's a certain type of action).
i.e., if I bind someComponentAction from a parent component to the
binding "action" I'm getting an exception telling me that there's no
such key (action, _action etc). I've set the
synchronizesVariablesWithBindings method to return false so I'm not
sure why this is happening.
Any help appreciated. (See below for component) Thanks!
the WOComponent...
Content: WOComponentContent {}
Form: WOGenericContainer {
elementName = "form";
method = "post";
action = actionURL;
invokeAction = actionResult;
}
...Java...
public class LDForm extends WOComponent {
public LDForm(WOContext context) {
super(context);
}
public boolean synchronizesVariablesWithBindings() {
return false;
}
public Boolean shouldUseComponentAction() {
if ( hasBinding( "shouldUseComponentAction" ) ) {
return ( Boolean )valueForBinding
( "shouldUseComponentAction" );
}
return Boolean.FALSE;
}
public NSDictionary queryDictionary() {
if ( hasBinding( "queryDictionary" ) ) {
return ( NSDictionary )valueForBinding
( "queryDictionary" );
}
return null;
}
public String actionURL() {
if ( ! shouldUseComponentAction().booleanValue() ) {
boolean hasActionClassBinding;
boolean hasDirectActionNameBinding;
hasActionClassBinding = hasBinding( "actionClass" );
hasDirectActionNameBinding = hasBinding
( "directActionName" );
if ( hasActionClassBinding ||
hasDirectActionNameBinding ) {
StringBuffer directAction;
directAction = new StringBuffer();
directAction.append( hasActionClassBinding ?
( String )valueForBinding( "actionClass" ) : "" );
if ( hasDirectActionNameBinding ) {
directAction.append( hasActionClassBinding ?
"/" : "" );
directAction.append( ( String )valueForBinding
( "directActionName" ) );
}
return context().directActionURLForActionNamed
( directAction.toString(), queryDictionary() );
}
}
return context().componentActionURL();
}
public WOActionResults actionResult() {
if ( shouldUseComponentAction().booleanValue() ) {
if ( hasBinding( "action" ) ) {
return ( WOComponent )valueForBinding( "action" );
}
else if ( hasBinding( "pageName" ) ) {
return pageWithName( ( String )valueForBinding
( "pageName" ) );
}
}
return null;
}
}
with regards,
--
LD
_______________________________________________
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