I've just read your previous thread,

are your components inside a For ? or an If, or a Block?

Cheers,
Ron


Leo Sakhvoruk wrote:
Hi Jesse,

The issue is (I created a thread about it earlier) that I have a page which contains several components, each of them contains a form with TextField components. When the TextField value is changed and the form is submitted, the values of the TextFields are never updated. I traced over the execution and it seems the rewind isn't propagating down to the forms inside of the components. So I'm trying to manually rewind the components (not sure if I'm going about this the right way) by calling the rewindFormComponent method but need the class types for that. Certainly, if there is a better way I'll take it.

Thanks.

Jesse Kuhnert wrote:

I think a clearer explanation would be that in most instances you shouldn't
have to directly interact with components in java code. There are special
cases, but for the most part there is probably a better way to do whatever
it is that you are doing.

What is the problem you are trying to solve that involves getting access to
all of these components?

On 3/7/06, Leo Sakhvoruk <[EMAIL PROTECTED]> wrote:
Thanks Alan, but what if there are 10+ components as in my case? It
would be pretty cumbersome to inject every single one of them.

Alan Chandler wrote:

On Tuesday 07 March 2006 20:11, Leo Sakhvoruk wrote:


Hi everyone,

I'm trying to manipulate components inside a form and am having trouble
casting them correctly. What class should components be cast to since
they're enhanced?



I found the easiest way is to inject them as per this example


     @InjectComponent("newrole")
     public abstract TextField getNewRoleField();

     public void updateRoles() {
             if (getButtonClicked() < 0) {
                     /*
                      * Create a new role
                      */
                     ValidRole vr = getNewRole();
if (!(vr.getName() == null || vr.getName().equals("")))

{
                             try{
                                     vr.create();
                             } catch (DatabaseException e) {
                                     ValidationDivDelegate delegate =

getDelegate();
                                     delegate.setFormComponent

(getNewRoleField());
delegate.record(getMessages().getMessage("error.naming"),

ValidationConstraint.CONSISTENCY);
                                     return;
                             }
                             setNewRole(null);  //Clear out the field

so its not detected next time
                     }
             }
     }
}










---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to