2 Replies Latest reply on Oct 22, 2007 4:57 AM by thatrichard

    Redirect on value change

      I want to change the page when a user selects a value in a combo box. There must be a standard way of doing this in Seam, but I'm not finding it. Can anyone point me in the right direction?

      I can force the submit as follows:

      <h:selectOneMenu id="outcome" value="#{assessmentSummary.liability}" onchange="submit()" immediate="true">
      ...
      


      But how do I get this submission to fire a redirect?

      Thanks

      Richard

        • 1. Re: Redirect on value change
          modoc

          Have you tried having your submit method return a string driving a navigation action from your pages.xml?

          I haven't done exactly what you're attempting, by why would a auto-submit be handled any differently than a manual submit?

          • 2. Re: Redirect on value change

            1. This may sound like an unbelievably silly question, but:

            What do you mean by my "submit method"? With, for example, h:commandButton, you specifiy the method via the action parameter.

            The submit method in my example is a javascript call fired by the browser when the field changes. That, I image, cases a postback, but I don't know how I would hook into that. Do you know what method gets invoked for a non-specific postback?

            2. To answer your question about auto and manual submits:

            As I understand it, when a submit button (incl. h:commandButton, h:commandLink) is fired it invokes a JSF Action, which returns a string value to drive navigation.

            ValueChangeListeners on the other hand raise an ActionListener event, which do not participate in navigation.

            The ValueChangeEvent happens first, so if I could hook into the submit, I could certainly make this work via pages.xml.

            Thanks for your input, though.

            Richard