Re: Reusable Components, Booleans
Re: Reusable Components, Booleans
- Subject: Re: Reusable Components, Booleans
- From: Art Isbell <email@hidden>
- Date: Thu, 17 Mar 2005 12:46:19 -1000
On Mar 17, 2005, at 11:09 AM, Janice Cheung wrote:
If I have reusable components within one webobject component, is it
possible to prohibit my page Form Submit to affect the
other components within the same template?
Without knowing how the reusable component is positioned within its
parent component and how the form relates to all of this, you can, of
course, have multiple forms on a page. You can sometimes include only
certain elements within each form to isolate one set of elements from
the submission of the other form. But because forms can't be nested,
this approach doesn't always work and is also a reason why including a
form in a reusable component can cause problems.
More specifically, I have a WebObject component, named UserHome.
UserHome contains the DisplayTemplate (Header, Footer, CrumbTrail),
and a SearchOptions component (three dropdown menus to search by
Institution, Department, and Division).
I have multiple boolean values set on this UserHome template,
basically to suppress duplicates in my Department array.
Once I access the three dropdown menus, my boolean values get
re-set along with the form submit (the action bound to my
PopUpButton).
Can I prevent this from happening?
It's not clear to me from your description which is the parent
component, whether there are one or two subcomponents, which component
contains the popup button, which component contains the form, whether
the form submission occurs because of a JavaScript event on the popup
button, whether an action method that reads the popup button selection
is bound to a submit button, etc.
But in general, you can usually do what's needed by overriding
takeValuesFromRequest(), invokeAction(), and/or appendToResponse() in
your parent component with the subcomponents set to not synchronize
their variables with their bindings automatically.
I have found that, in general, it's easier for me to control what's
happening by setting the values of those key variables that depend on
the variable bound to the "item" key in repetitions, popup buttons,
etc. in the "item" variable setter method and by setting most of the
remainder of the key variables in appendToResponse() prior to super's
invocation. Not only does this minimize computations that would occur
repeatedly and unnecessarily in key variable getter and setter methods
but it also allows better control of problems like you're experiencing.
There are, of course, situations in which key variables can or should
be set or their current values cached in the component constructor,
awake(), sleep(), takeValuesFromRequest(), invokeAction(), or maybe a
key variable setter or getter method.
So how's that for a non-solution that's so ethereal as to be almost
incomprehensible? :-)
Aloha,
Art
_______________________________________________
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