Using FlexibleStringExpander in form widget field's parameter names

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

Using FlexibleStringExpander in form widget field's parameter names

Daniel Watford
Hello,

In a current project being built on top of Ofbiz I have a form for editing details of a freight transport job. Each job has multiple roles performed by different parties - Shipper, Consignee, Agent, BILL_TO_PARTY, etc.

The client required that the party contact details for each role be editable on the same form as the Job to allow operators to more easily capture job details.

Building the form using the form widget xml was overly verbose and wasn't a good solution in cases where multiple parties might hold a role - e.g. there can be multiple billing parties for a job.

I ended up using FTL macros for rendering each of the roles on the form.

I've started looking at how I might move from the FTL macros back to the Form Widget, but have run into the problem of duplicate form input names when including a form multiple times on a screen.

To resolve this I tried using the FlexibleStringExpander for a form field's parameter name.



To use the demonstration, build the branch and loadAll demo data.
Run ofbiz and visit https://localhost:8443/partymgr

 
The demo displays 5 Persons and 5 PartyGroups in random order, using a different included form for each type.

Click on Update


The next form shows all the fields that were posted.


Any issues that might come up from using FlexibleStringExpander for parameter names in this way?

Thanks,

Dan.

--
Reply | Threaded
Open this post in threaded view
|

Re: Using FlexibleStringExpander in form widget field's parameter names

Nicolas Malin-2

Hi Daniel,

Thanks for your detailed proposal. I checked your work and it's interesting way.

Can you open an issue on https://issues.apache.org/jira, I will commit your widget improvement in code base.

Nicolas

On 23/01/2020 22:03, Daniel Watford wrote:
Hello,

In a current project being built on top of Ofbiz I have a form for editing details of a freight transport job. Each job has multiple roles performed by different parties - Shipper, Consignee, Agent, BILL_TO_PARTY, etc.

The client required that the party contact details for each role be editable on the same form as the Job to allow operators to more easily capture job details.

Building the form using the form widget xml was overly verbose and wasn't a good solution in cases where multiple parties might hold a role - e.g. there can be multiple billing parties for a job.

I ended up using FTL macros for rendering each of the roles on the form.

I've started looking at how I might move from the FTL macros back to the Form Widget, but have run into the problem of duplicate form input names when including a form multiple times on a screen.

To resolve this I tried using the FlexibleStringExpander for a form field's parameter name.



To use the demonstration, build the branch and loadAll demo data.
Run ofbiz and visit https://localhost:8443/partymgr

 
The demo displays 5 Persons and 5 PartyGroups in random order, using a different included form for each type.

Click on Update


The next form shows all the fields that were posted.


Any issues that might come up from using FlexibleStringExpander for parameter names in this way?

Thanks,

Dan.

--

pEpkey.asc (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Using FlexibleStringExpander in form widget field's parameter names

Daniel Watford
Hi Nicolas,

Issues created (https://issues.apache.org/jira/browse/OFBIZ-11330) .

PR with changes https://github.com/apache/ofbiz-framework/pull/7 with the
addition of a couple of test cases.
I can convert to a patch if preferred.


On Tue, 28 Jan 2020 at 08:21, Nicolas Malin <[hidden email]>
wrote:

> Hi Daniel,
>
> Thanks for your detailed proposal. I checked your work and it's
> interesting way.
>
> Can you open an issue on https://issues.apache.org/jira, I will commit
> your widget improvement in code base.
>
> Nicolas
> On 23/01/2020 22:03, Daniel Watford wrote:
>
> Hello,
>
> In a current project being built on top of Ofbiz I have a form for editing
> details of a freight transport job. Each job has multiple roles performed
> by different parties - Shipper, Consignee, Agent, BILL_TO_PARTY, etc.
>
> The client required that the party contact details for each role be
> editable on the same form as the Job to allow operators to more easily
> capture job details.
>
> Building the form using the form widget xml was overly verbose and wasn't
> a good solution in cases where multiple parties might hold a role - e.g.
> there can be multiple billing parties for a job.
>
> I ended up using FTL macros for rendering each of the roles on the form.
>
> I've started looking at how I might move from the FTL macros back to the
> Form Widget, but have run into the problem of duplicate form input names
> when including a form multiple times on a screen.
>
> To resolve this I tried using the FlexibleStringExpander for a form
> field's parameter name.
>
> I've created a branch here:
> https://github.com/danwatford/ofbiz-framework/tree/flexible-form-parameter-name
>
>
> And a demonstration of how it might be used here:
> https://github.com/danwatford/ofbiz-framework/tree/flexible-form-parameter-name-demo
>
> To use the demonstration, build the branch and loadAll demo data.
> Run ofbiz and visit https://localhost:8443/partymgr
> [image: image.png]
>
> The demo displays 5 Persons and 5 PartyGroups in random order, using a
> different included form for each type.
>
> Click on Update
> [image: image.png]
>
> The next form shows all the fields that were posted.
>
>
> Any issues that might come up from using FlexibleStringExpander for
> parameter names in this way?
>
> Thanks,
>
> Dan.
>
> --
>
>

--
Daniel Watford