[OFBiz] Dev - Reusable form question

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[OFBiz] Dev - Reusable form question

Kasubaski, Matt

I’m currently in the process of changing how the update address screen behaves and could use some help.

 

The editcontactmech.ftl form currently has two buttons, Go Back, and Save.  On Save, the form is submitted, the updatePostalAddress service is called, and the form is redisplayed on success/failure.  What I want to do is, on success of the updating of the address, return to where it came from. 

 

The problem is, the form is called in a number of places, view profile, and checkout process being the most visible.  This means that I can’t just change the location of where SUCCESS goes in the controller.xml file since it will always go there.

 

Ideally, I would want to put a variable name in the value section of the response, but I don’t see any code that supports that.

  IE:    NOTE: I know ${done_page} is can only be used in freemarker.  It’s an example to illustrate it’s a variable in the context/session/request

  <request-map uri="updatePostalAddress">

        <security https="true" auth="true"/>

        <event type="service" invoke="updatePartyPostalAddress"/>

        <response name="success" type="view" value="${done_page}"/>

        <response name="error" type="view" value="editcontactmech"/>

    </request-map>

 

I see two ways of doing this:

  1)  Change the form name in editcontactmech.ftl to change based on what $done_page is defined to, then add a new request-map for each call and change the SUCCESS value to point to the returning page.

 

  2) Change the SUCCESS value to a new request-map which then calls a new service which converts the $done_page to a result code.  Then the request-map can have the conversions for each way the form can be called.

IE:

  <request-map uri="updatePostalAddress">

        <security https="true" auth="true"/>

        <event type="service" invoke="updatePartyPostalAddress"/>

        <response name="success" type="request" value="donePage"/>

        <response name="error" type="view" value="editcontactmech"/>

    </request-map>

  <request-map uri="donePage">

        <security https="true" auth="true"/>

        <event type="service" invoke="convertDonePageToResult"/>

        <response name="viewprofile" type="view" value="viewprofle"/>

        <response name="checkoutshippingaddress" type="view" value="checkoutshippingaddress"/>

    </request-map>

 

Of the two, I prefer the second option.  It’s cleaner and easier to read.

 

Is there a better way to do this?

 

Thanks,

 

Matt

 

 


 
_______________________________________________
Dev mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Re: [OFBiz] Dev - Reusable form question

Si Chen-2
Have you looked at the editcontactmech.ftl in partymgr? A done page is
passed in as part of a URL. It is then appended to the end of the
posting URL, and that causes the re-direction after the page is done.

Si

Kasubaski, Matt wrote:

> I’m currently in the process of changing how the update address screen
> behaves and could use some help.
>
> The editcontactmech.ftl form currently has two buttons, Go Back, and
> Save. On Save, the form is submitted, the updatePostalAddress service
> is called, and the form is redisplayed on success/failure. What I want
> to do is, on success of the updating of the address, return to where
> it came from.
>
> The problem is, the form is called in a number of places, view
> profile, and checkout process being the most visible. This means that
> I can’t just change the location of where SUCCESS goes in the
> controller.xml file since it will always go there.
>
> Ideally, I would want to put a variable name in the value section of
> the response, but I don’t see any code that supports that.
>
> IE: NOTE: I know ${done_page} is can only be used in freemarker. It’s
> an example to illustrate it’s a variable in the context/session/request
>
> <request-map uri="updatePostalAddress">
>
> <security https="true" auth="true"/>
>
> <event type="service" invoke="updatePartyPostalAddress"/>
>
> <response name="success" type="view" value="${done_page}"/>
>
> <response name="error" type="view" value="editcontactmech"/>
>
> </request-map>
>
> I see two ways of doing this:
>
> 1) Change the form name in editcontactmech.ftl to change based on what
> $done_page is defined to, then add a new request-map for each call and
> change the SUCCESS value to point to the returning page.
>
> 2) Change the SUCCESS value to a new request-map which then calls a
> new service which converts the $done_page to a result code. Then the
> request-map can have the conversions for each way the form can be called.
>
> IE:
>
> <request-map uri="updatePostalAddress">
>
> <security https="true" auth="true"/>
>
> <event type="service" invoke="updatePartyPostalAddress"/>
>
> <response name="success" type="request" value="donePage"/>
>
> <response name="error" type="view" value="editcontactmech"/>
>
> </request-map>
>
> <request-map uri="donePage">
>
> <security https="true" auth="true"/>
>
> <event type="service" invoke="convertDonePageToResult"/>
>
> <response name="viewprofile" type="view" value="viewprofle"/>
>
> <response name="checkoutshippingaddress" type="view"
> value="checkoutshippingaddress"/>
>
> </request-map>
>
> Of the two, I prefer the second option. It’s cleaner and easier to read.
>
> Is there a better way to do this?
>
> Thanks,
>
> Matt
>
>------------------------------------------------------------------------
>
>
>_______________________________________________
>Dev mailing list
>[hidden email]
>http://lists.ofbiz.org/mailman/listinfo/dev
>
 
_______________________________________________
Dev mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Re: Dev - Reusable form question

Daniel Kunkel
In reply to this post by Kasubaski, Matt
Hi Matt

I was looking through some old posts, and ran across this...

How did you progress with it?

Thanks



On Tue, 2005-11-22 at 11:44 -0600, Kasubaski, Matt wrote:

> I’m currently in the process of changing how the update address screen
> behaves and could use some help.
>
>  
>
> The editcontactmech.ftl form currently has two buttons, Go Back, and
> Save.  On Save, the form is submitted, the updatePostalAddress service
> is called, and the form is redisplayed on success/failure.  What I
> want to do is, on success of the updating of the address, return to
> where it came from.  
>
>  
>
> The problem is, the form is called in a number of places, view
> profile, and checkout process being the most visible.  This means that
> I can’t just change the location of where SUCCESS goes in the
> controller.xml file since it will always go there.
>
>  
>
> Ideally, I would want to put a variable name in the value section of
> the response, but I don’t see any code that supports that.
>
>   IE:    NOTE: I know ${done_page} is can only be used in freemarker.
> It’s an example to illustrate it’s a variable in the
> context/session/request
>
>   <request-map uri="updatePostalAddress">
>
>         <security https="true" auth="true"/>
>
>         <event type="service" invoke="updatePartyPostalAddress"/>
>
>         <response name="success" type="view" value="${done_page}"/>
>
>         <response name="error" type="view" value="editcontactmech"/>
>
>     </request-map>
>
>  
>
> I see two ways of doing this:
>
>   1)  Change the form name in editcontactmech.ftl to change based on
> what $done_page is defined to, then add a new request-map for each
> call and change the SUCCESS value to point to the returning page.
>
>  
>
>   2) Change the SUCCESS value to a new request-map which then calls a
> new service which converts the $done_page to a result code.  Then the
> request-map can have the conversions for each way the form can be
> called.
>
> IE:
>
>   <request-map uri="updatePostalAddress">
>
>         <security https="true" auth="true"/>
>
>         <event type="service" invoke="updatePartyPostalAddress"/>
>
>         <response name="success" type="request" value="donePage"/>
>
>         <response name="error" type="view" value="editcontactmech"/>
>
>     </request-map>
>
>   <request-map uri="donePage">
>
>         <security https="true" auth="true"/>
>
>         <event type="service" invoke="convertDonePageToResult"/>
>
>         <response name="viewprofile" type="view" value="viewprofle"/>
>
>         <response name="checkoutshippingaddress" type="view"
> value="checkoutshippingaddress"/>
>
>     </request-map>
>
>  
>
> Of the two, I prefer the second option.  It’s cleaner and easier to
> read.
>
>  
>
> Is there a better way to do this?
>
>  
>
> Thanks,
>
>  
>
> Matt
>
>  
>
>  
>
>
>  _______________________________________________
> Dev mailing list
> [hidden email]
> http://lists.ofbiz.org/mailman/listinfo/dev
--
Daniel

*-.,,.-*"*-.,,.-*"*-.,,.-*"*-.,,.-*"*-.,,.-*"*-.,,.-*"*-.,,.-*"*-
Have a GREAT Day!

Daniel Kunkel           [hidden email]
BioWaves, LLC           http://www.BioWaves.com
14150 NE 20th St. Suite F1
Bellevue, WA 98007
800-734-3588    425-895-0050
http://www.Apartment-Pets.com  http://www.Focus-Illusion.com
http://www.Brain-Fun.com       http://www.ColorGlasses.com
*-.,,.-*"*-.,,.-*"*-.,,.-*"*-.,,.-*"*-.,,.-*"*-.,,.-*"*-.,,.-*"*-

 
_______________________________________________
Dev mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/dev