Hello All,
After creating an item in ofbiz. The browser address bar is left pointing to request that would end up showing an error/info message during a page reload or refresh.
I would like to know if this is an inherent nature of the ofbiz MVC implementation or is there already a solution to this observation?
As an example, after successfullly creating a new product. The browser address bar contains an URL that points to last request that was called as a result of saving the new product info.
http://demo-trunk.ofbiz.apache.org/catalog/control/createProduct . The issue is that if the the user reloads the same page, an error message is shown.
The Following Errors Occurred:
The following required parameter is missing: [IN] [createProduct.internalName]
The following required parameter is missing: [IN] [createProduct.productTypeId]
This is expected and can easily be rectified with the following change in controller.xml
Previous
<request-map uri="createProduct">
<security https="true" auth="true"/>
<event type="service" path="" invoke="createProduct"/>
<response name="success" type="view" value="EditProduct"/>
<response name="error" type="view" value="EditProduct"/>
</request-map>
Niew
<request-map uri="createProduct">
<security https="true" auth="true"/>
<event type="service" path="" invoke="createProduct"/>
<response name="success" type="request-redirect" value="EditProduct">
<redirect-parameter name="productId"/>
</response>
<response name="error" type="view" value="EditProduct"/>
</request-map>
The only thing to note about this fix is the extra request/response cycle that results.
I think the bigger issue is with the form widget. <form name="formName" type="list"...> configure to show a submit or some other button (eg. delete button) with each entry listed.
Assuming a 'delete' button is configured beside each listing entry, clicking on the 'delete' button would cause the browser to send a http POST to ofbiz to call some delete function (eg. deleteAbc). As a result, after the http POST is complete, the browser address bar is left pointing to
http://demo-trunk.ofbiz.apache.org/somecomponent/deleteAbc. Now if the user were to do a page reload or refresh the page, an error/info message would be shown.
Thanks