> thats odd, all the values should be preserved, thats our rawinput that
> all formcomponents have. Do you have a repeater/listview around your
> formcomponents.
> 

Hmmm, I don't know why my form doesn't preserve it. Here's the source of
the form. Can you spot anything that I'm doing wrong?

// -[KeepHeading]-


// -[Copyright]-

/**
 * (c) 2007. Step Ahead Software. All rights reserved.
 * 
 * Source file created and managed by Javelin (TM) Step Ahead Software.
 * To maintain code and model synchronization you may directly edit code
in method bodies
 * and any sections starting with the 'Keep_*' marker. Make all other
changes via Javelin.
 * See http://stepaheadsoftware.com for more details.
 */
package com.sas.av.ui.wicket.templates.original;

import java.lang.*;
import com.sas.av.ui.wicket.templates.original.StandardPage;
    
import com.sas.av.model.context.EServerContext;


// -[KeepBeforeClass]-
import com.sas.av.ui.wicket.templates.*;

import wicket.PageParameters;
import wicket.markup.html.basic.Label;
import wicket.markup.html.form.*;
import wicket.markup.html.panel.*;
import wicket.util.string.*;
import wicket.model.*;

import wicket.model.PropertyModel;

import wicket.markup.html.image.*;
import wicket.extensions.markup.html.captcha.*;

import java.lang.*;
import java.util.Random;



// -[Class]-

/**
 * Information Request Page.
 * 
 * @author Chris Colman
 */
public 
class InformationRequestPage extends StandardPage
{
// -[KeepWithinClass]-


    // inner class form:        

    public final class InformationRequestForm extends Form
    {
      private final InformationRequest infoRequest =
                new InformationRequest();

        // CAPTCHA Challenge
      private String captchaValue = generateCaptchaValue();
      private String captchaInput = new String("fred");
        public String getCaptchaInput() {return captchaInput;}
        public void setCaptchaInput(String iCaptchaInput)
                { captchaInput = iCaptchaInput; }
      public String generateCaptchaValue()
                { return
Integer.toString(random.nextInt(2000000)+1000000); }
        private Image captchaImage = new Image("captchaImage");
        private CaptchaValidator captchaValidator;

      public InformationRequestForm(final String iId)
      {
        super(iId);

                add(new TextArea("name", new PropertyModel(infoRequest,
"name")).setRequired(true));
                add(new TextArea("company", new
PropertyModel(infoRequest, "company")));
                add(new TextArea("phone", new PropertyModel(infoRequest,
"phone")));
                add(new TextArea("email", new PropertyModel(infoRequest,
"email")).setRequired(true));
                add(new TextArea("comments", new
PropertyModel(infoRequest, "comments")));

                TextField captchaField = new TextField("captcha", new
PropertyModel(this, "captchaInput"));
                captchaValidator = new CaptchaValidator(captchaValue);
                captchaField.add(captchaValidator);
                add(captchaField);
             
                refreshCapture();
                add(captchaImage);
        }

        public final void onError()
        {
                super.onError();
                        
                // update model fields so the user doesn't have to 
                // type them in again
                updateFormComponentModels();
                refreshCapture();
        }
                
        public void refreshCapture()
        {
                captchaValue = generateCaptchaValue();                  
                CaptchaImageResource captchaImageResource = new
CaptchaImageResource(captchaValue, 80, 5); 
                captchaImage.setImageResource(captchaImageResource);
                captchaValidator.setCaptchaValue(captchaValue);
        }
        

        public final void onSubmit()
      {
                StringBuffer sb = new StringBuffer();
                sb.append("Name " + infoRequest.getName());

                PageParameters pageParameters = new PageParameters();
        
                // set up parameters
                ...
                        
                setResponsePage(
                        InformationRequestAckPage.class,
pageParameters);
     }
}


// -[Fields]-



/**
 * A random object!
 */
public static transient Random random = new Random();


// -[Methods]-




/**
 * Constructs the object
 */
public InformationRequestPage()



{
}

/**
 * 
 */
public InformationRequestPage(final PageParameters parameters)
  throws StringValueConversionException
{
        super(parameters);
        
        add(new FeedbackPanel("feedback"));
        add(new InformationRequestForm("informationRequest"));
}

}



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

Reply via email to