Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8778951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:39:22+00:00 2026-06-13T19:39:22+00:00

I have a simple FormPage derived from WebPage defined like this: public FormPage() {

  • 0

I have a simple FormPage derived from WebPage defined like this:

public FormPage() {

    final FeedbackPanel feedback = new FeedbackPanel("feedback");
    add(feedback);

    final TextField<String> entry = new TextField<String>("entry");

    final Button button = new Button("button");
    button.add(new AjaxEventBehavior("onclick") {
        @Override
        protected void onEvent(final AjaxRequestTarget target) {
            System.out.println("Event");
        }
    });

    Form<DataModel> form = new Form<User>("userForm", new CompoundPropertyModel<DataModel>(dataModel)) { 

        @Override
        protected void onValidate() {
            System.out.println("Validate");
            String entryValue = entry.getValue();
            if (entryValue == null || entryValue.length() == 0) {
                error("entry value required");
            }
        };

        @Override
        protected void onSubmit() {
            System.out.println("Submit");
            if (!hasErrors()) {
                String entryValue = entry.getValue();
                if (!entryValue.equals("value")) {
                    error("entry has wrong value");
                }
            }
        };
    };

    form.add(entry);
    form.add(button);
    add(form);
}

I’m trying to do something (in this example just printing to console) on form submission, so I’ve attached AjaxEventBehavior on button’s onclick event. This works perfectly: action is performed on button click, but now the form is not being submitted.

I also was experimenting with

form.add(new AjaxEventBehavior("onsubmit")

and this event handler also prevents form submission.
For example,

entry.add(new AjaxEventBehavior("onclick")

allows form to be submitted, but the event is not related to submission.
Now I’m puzzled how can I have my form submitted and perform some action on this event.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T19:39:23+00:00Added an answer on June 13, 2026 at 7:39 pm

    By default in Wicket 6, a behavior attached to a component prevents the default component action from happening.

    If you want to trigger both the behavior and the component action you have to override the updateAjaxRequestAttributes method in your behavior:

    @Override
    protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
        super.updateAjaxAttributes(attributes);
        attributes.setAllowDefault(true);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This seems like a fairly simple problem to me but I have been having
I have simple models with generic relations from this example at the Django Project
I have a simple select form. When a year is selected from the form
I have simple problem with divs. I would like to create one big div
I have simple page with multiple check boxes and radio buttons, This is only
I have simple drag and drop functions implemented in QmainWindow the reference taken from
I have simple example: function File(name) { this.name = name this.text = null }
I have simple shared memory DLL for interprocess data exchange from unmanaged to managed
i have simple side menu with this html code : <div id=menu> <div> Menu
I am new to Netbeans . I have created a simple php project. It

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.