Hello everyone,
Please excuse this newbie question but I'm still coming up to speed on WW and I've run 
into a little problem with checkboxes.  There wasn't an example in the distribution 
that I could find for the following situation.

On my form I have the following:

<form action="<webwork:url page="foo.action"/>" method="POST">
  <ui:textfield label="'Email'" name="'email'" maxlength="100"/>
  <ui:textfield label="'Confirm email'" name="'confirmedEmail'" maxlength="100"/>
  <ui:checkbox label="'Check here to receive newsletter'" name="'newsletter'" 
fieldValue="true"/>
</form>

On initial load I want the checkbox to default to checked.  In my Action class I have:

    protected boolean newsletter = true;
    protected boolean promotions = true;

    public boolean getNewsletter()
    {
        System.err.println( "getNewsletter()" );
        
        return newsletter;
    }
    
    public void setNewsletter( boolean checked )
    {
        System.err.println( "setNewsletter()" );
        
        this.newsletter = checked;
    }

This works fine on initial load (foo!default.action) but fails on the POST feedback 
loop (e.g. user enters invalid e-mail address) if I deselect the newsletter checkbox.  
The checkbox will stay checked because the internal state has already been set to true.

Since there is no parameter being passed to the WW dispatcher, setNewletter(false) 
will never get called, right?  How do I handle a "missing" parameter in WW???

Am I missing something?   

Thanks,
Kirk Rasmussen
Lucasfilm Ltd.


-------------------------------------------------------
This sf.net email is sponsored by:
With Great Power, Comes Great Responsibility
Learn to use your power at OSDN's High Performance Computing Channel
http://hpc.devchannel.org/
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Reply via email to