Announcement Announcement Module
Collapse
No announcement yet.
AbstractWizardFormController POST for new form Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • AbstractWizardFormController POST for new form

    Hi,

    I'll try and explain what I'm trying to acheive, and then how I'm currently attempting it...

    We have a multipage form which works fine. However, we'd like to have a quick-start-form on other pages of the site. By this I mean a small two field form that has, say, username and DOB as well as a submit button:

    Code:
    <form name="authorisationForm" method="post" action="authorisationForm">
    <div id="tsr1_main_area_contentDiv" class="tsr_main_area">
    	<div class="horzntl_10px"></div>
    		<input name="username" />
    		<select name="dob">
    	<div id="tsr1_new_auth_submitDiv" class="floatRight">
    		<input type="submit" name="_target1" value="" class="tsr_box_create" alt="Click to create a new account"/>
    	</div><div class="clearBoth"></div>
    </div>
    </form>
    This calls an AbstractWizardFormController, but I'd like to POST the details rather than GET them.

    AFAIA a GET call is necessary for the form backing object to be instanciated as well as some other methods (onBindNewForm?).

    Is there an easy way to achieve what I desire? I'm guessing it might have something to do with isFormSubmit but to be honest I'm a little lost in the flow of controller internals.

    If there's anything else I can do to help elucidate please let me know, all comments most gratefully received!

    TIA,
    SNR

  • #2
    Sorry to bump but I really could do with some help on this... Is is possible to start the lifecyle of the AbstractWizardFormController with a POST request rather than a GET?

    I'm asking this as we have a form on a separate page which provides two values necessary for the form, username and DOB. Currently we are passing them in via URL GET parameters, however this exposes the information in the address bar and we would like to POST them instead. Is this possible?

    Comment


    • #3
      Well since none of the "experts" was willing to help I finally suceeded in solving the problem.

      For others that are interested the key lay in overriding the handleRequestInternal and isFormSubmission methods in the AbstractWizardFormController.

      isFormSubmission basically checks to see if its a HTTP POST request, and if so whether the request has an attribute for either target-page, finish, or cancel. Therefore by changing its behaviour you can then process the request "as normal" in your controller's handleRequestInternal.

      Isn't it nice when someone from the community offers the odd idea or bit of help... oh wait no that doesn't happen that much unless you're asking which way to the manual.

      Comment


      • #4
        It sounds like you are doing more work than you have to. When I use the AbstractWizardFormController, my URL never changes (e.g., the whole way through the wizard, my url in the address bar is the same). So I'm not sure why you are saying that you can see the username and DOB in the address bar unless you have another controller that returns the wizard view or you are using a GET. If that is the case, all you have to do is set the DOB form method to post (There is no way your example in your first post works). The controllers do not require GET requests. Anyway, I utilize these three methods in the AbstractWizardFormController:

        1. validatePage(Object command, Errors errors, int page)
        2. processCancel(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors)
        3. processFinish(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors)

        The method validatePage gives you access to the request for each individual page (0-based) everytime _target#, _cancel, or _finish is passed in the request. This is your chance to perform any validation/processing for a single page.

        As for your comments in your third post, it wouldn't hurt to read the API documentation once in awhile. If you look up AbstractWizardFormController, you will see how the _target#, _cancel, and _finish attributes work. It covers this in detail.

        Comment


        • #5
          Same problem

          I need to call a WizardController from an external page.
          But wizardcontrollers can not take a post method(as a first request), because they think that is a formSubmision.

          How to begin a wizard with a post method call??

          Comment


          • #6
            Hello

            How to start a wizard from whit a POST request?
            any body knows?


            FORM.html -------------> wizardController (use params)
            post(params)

            Comment

            Working...
            X