I am trying to use an AjaxSubmitLink to show a panel when a button is clicked. I am receiving the following error when I try to submit the form:

Wicket.Ajax.Call.processComponent: Component with id [[verifyPanelWmc9]] a was not found while trying to perform markup update. Make sure you called component.setOutputMarkupId(true) on the component whose markup you are trying to update.

My code is as follows:

public class InitiateDeclarationPage extends EzdecBaseWebPage {
    @SpringBean
    private IDeclarationService declarationService;

    public InitiateDeclarationPage() {
        final Declaration declaration = new Declaration(EzdecSession.getCurrentUser().getAccount(),
                EzdecSession.getCurrentUser(), "", County.COOK, State.ILLINOIS);
        add(new FeedbackPanel("feedback"));

        final Form form = new Form("initiateDeclarationForm", new CompoundPropertyModel<Declaration>(declaration));
           
        form.add(new Button("submitButton") {
            @Override
            public void onSubmit() {
                Declaration declaration = (Declaration) form.getModelObject();
                declaration.setStatus(Status.OPEN);
                ParcelIdentification pin = declarationService.findParcelIdentification(declaration.getPin());
                if (pin == null) {
                    error("No PIN found for PIN " + getFormattedPIN(declaration.getPin()));
                } else {
                    if (declarationService.initiateDeclaration(declaration)) {
                        EzdecSession.get().info("Declaration " + declaration.getTxNumber() + " created");
                        setResponsePage(new DeclarationPage(declaration, 0, pin));
                    } else {
                        error("Creating declaration with PIN: " + declaration.getPin());
                    }
                }
            }
        });

        final EzdecRequiredTextField pinText = new EzdecRequiredTextField("pin");
        form.add(pinText);
       
        form.add(new DropDownChoice("county", Arrays.asList(County.values()))
                 .setRequired(true)
                 .setEnabled(false));

        final WebMarkupContainer parent = new WebMarkupContainer("verifyPanelWmc");
//        parent.setOutputMarkupId(true);
        parent.setVisible(false);
        form.add(parent);

        AjaxSubmitLink verifyPinLink = new AjaxSubmitLink("verifyPinLink") {
            @Override
            public void onSubmit(AjaxRequestTarget target, Form form) {
                Declaration declaration = (Declaration) form.getModelObject();
                ParcelIdentification pid = declarationService.findParcelIdentification(declaration.getPin());
                if (pid == null) {
                    error("No PIN found for PIN " + declaration.getPin());
                } else {
//                    parent.setOutputMarkupId(true);
                    InitiateDeclarationVerifyPanel decVerifyPanel = new InitiateDeclarationVerifyPanel("verifyPanel", pid);
                    decVerifyPanel.setOutputMarkupId(true);
                    decVerifyPanel.setVisible(true);
                    parent.add(decVerifyPanel);
                    parent.setVisible(true);
                    target.addComponent(decVerifyPanel);
//                    target.addComponent(parent);
                }
            }
        };

        form.add(verifyPinLink);

        add(form);
    }

}

Anyone know how I can get around this?

Reply via email to