Re: svn commit: r762224 - /ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/order/orderitems.ftl

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

Re: svn commit: r762224 - /ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/order/orderitems.ftl

David E. Jones-2

This is another weird one... why is the action set in the JavaScript?  
It makes the javascript unnecessarily complex as the action should be  
defined on the form element.

In general there is no need for the href to contain anything other than:

"javascript:document.${formName}.submit()"

In other words, the need for the action setting  
(document.addCommonToCartForm.action='<@ofbizUrl>cancelOrderItem</
@ofbizUrl>';) should be checked and removed.

-David


On Apr 6, 2009, at 12:55 AM, [hidden email] wrote:

> Author: jleroux
> Date: Mon Apr  6 06:55:07 2009
> New Revision: 762224
>
> URL: http://svn.apache.org/viewvc?rev=762224&view=rev
> Log:
> A patch from Ashish Nagar "Secure URLs in Freemarker templates  
> files" https://issues.apache.org/jira/browse/OFBIZ-2260
>
> Modified:
>    ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/order/
> orderitems.ftl
>
> Modified: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/
> order/orderitems.ftl
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/order/orderitems.ftl?rev=762224&r1=762223&r2=762224&view=diff
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/order/
> orderitems.ftl (original)
> +++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/order/
> orderitems.ftl Mon Apr  6 06:55:07 2009
> @@ -186,7 +186,7 @@
>                   </select>
>                   <b>${uiLabelMap.CommonComments}</b>
>                   <input class="inputBox" type="text" name="icm_$
> {orderItem.orderItemSeqId}" value="" size="30" maxlength="60"/></
> div></td>
> -                  <td colspan="4" align="right"><a  
> href
> =
> "javascript:document
> .addCommonToCartForm
> .method
> =
> 'post
> ';document.addCommonToCartForm.action='<@ofbizUrl>cancelOrderItem</
> @ofbizUrl>';document.addCommonToCartForm.submit()"  
> class="buttontext">${uiLabelMap.CommonCancel}</a>
> +                  <td colspan="4" align="right"><a  
> href
> =
> "javascript:document
> .addCommonToCartForm.action='<@ofbizUrl>cancelOrderItem</
> @ofbizUrl>';document.addCommonToCartForm.submit()"  
> class="buttontext">${uiLabelMap.CommonCancel}</a>
>                     <input type="hidden" name="orderItemSeqId"  
> value="${orderItem.orderItemSeqId}"/>
>                   </td>
>               </tr>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r762224 - /ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/order/orderitems.ftl

Ashish Nagar
Hello David,

As, the action url for form "addCommonToCartForm" was already defined in
orderstatus.ftl, as "<@ofbizUrl>addordertocart/orderstatus</@ofbizUrl>",
so I had to use it that way. Not sure, how this need could be fulfilled,
i.e. altering the attributes of the form, without using javascript.

I found a couple of similar tricks in the orderitem.ftl page,
<a
href="javascript:document.addCommonToCartForm.add_all.value='true';document.addCommonToCartForm.submit()"
class="submenutext">${uiLabelMap.OrderAddAllToCart}</a><a
href="javascript:document.addCommonToCartForm.add_all.value='false';document.addCommonToCartForm.submit()"
class="submenutext">${uiLabelMap.OrderAddCheckedToCart}</a>

One way I think, is to create separate forms for these. Please, suggest
how else it could be done.

Kind Regards,
--
Ashish Nagar


David E Jones wrote:

>
> This is another weird one... why is the action set in the JavaScript?
> It makes the javascript unnecessarily complex as the action should be
> defined on the form element.
>
> In general there is no need for the href to contain anything other than:
>
> "javascript:document.${formName}.submit()"
>
> In other words, the need for the action setting
> (document.addCommonToCartForm.action='<@ofbizUrl>cancelOrderItem</@ofbizUrl>';)
> should be checked and removed.
>
> -David
>
>
> On Apr 6, 2009, at 12:55 AM, [hidden email] wrote:
>
>> Author: jleroux
>> Date: Mon Apr  6 06:55:07 2009
>> New Revision: 762224
>>
>> URL: http://svn.apache.org/viewvc?rev=762224&view=rev
>> Log:
>> A patch from Ashish Nagar "Secure URLs in Freemarker templates files"
>> https://issues.apache.org/jira/browse/OFBIZ-2260
>>
>> Modified:
>>    
>> ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/order/orderitems.ftl
>>
>>
>> Modified:
>> ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/order/orderitems.ftl
>>
>> URL:
>> http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/order/orderitems.ftl?rev=762224&r1=762223&r2=762224&view=diff 
>>
>> ==============================================================================
>>
>> ---
>> ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/order/orderitems.ftl
>> (original)
>> +++
>> ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/order/orderitems.ftl
>> Mon Apr  6 06:55:07 2009
>> @@ -186,7 +186,7 @@
>>                   </select>
>>                   <b>${uiLabelMap.CommonComments}</b>
>>                   <input class="inputBox" type="text"
>> name="icm_${orderItem.orderItemSeqId}" value="" size="30"
>> maxlength="60"/></div></td>
>> -                  <td colspan="4" align="right"><a
>> href="javascript:document.addCommonToCartForm.method='post';document.addCommonToCartForm.action='<@ofbizUrl>cancelOrderItem</@ofbizUrl>';document.addCommonToCartForm.submit()"
>> class="buttontext">${uiLabelMap.CommonCancel}</a>
>> +                  <td colspan="4" align="right"><a
>> href="javascript:document.addCommonToCartForm.action='<@ofbizUrl>cancelOrderItem</@ofbizUrl>';document.addCommonToCartForm.submit()"
>> class="buttontext">${uiLabelMap.CommonCancel}</a>
>>                     <input type="hidden" name="orderItemSeqId"
>> value="${orderItem.orderItemSeqId}"/>
>>                   </td>
>>               </tr>
>>
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r762224 - /ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/order/orderitems.ftl

Jacques Le Roux
Administrator
Hi Ashish,

Please see my comment at
https://issues.apache.org/jira/browse/OFBIZ-2260?focusedCommentId=12698001&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#action_12698001

Jacques

From: "Ashish Nagar" <[hidden email]>

> Hello David,
>
> As, the action url for form "addCommonToCartForm" was already defined in orderstatus.ftl, as
> "<@ofbizUrl>addordertocart/orderstatus</@ofbizUrl>", so I had to use it that way. Not sure, how this need could be fulfilled, i.e.
> altering the attributes of the form, without using javascript.
>
> I found a couple of similar tricks in the orderitem.ftl page,
> <a href="javascript:document.addCommonToCartForm.add_all.value='true';document.addCommonToCartForm.submit()"
> class="submenutext">${uiLabelMap.OrderAddAllToCart}</a><a
> href="javascript:document.addCommonToCartForm.add_all.value='false';document.addCommonToCartForm.submit()"
> class="submenutext">${uiLabelMap.OrderAddCheckedToCart}</a>
>
> One way I think, is to create separate forms for these. Please, suggest how else it could be done.
>
> Kind Regards,
> --
> Ashish Nagar
>
>
> David E Jones wrote:
>>
>> This is another weird one... why is the action set in the JavaScript? It makes the javascript unnecessarily complex as the action
>> should be defined on the form element.
>>
>> In general there is no need for the href to contain anything other than:
>>
>> "javascript:document.${formName}.submit()"
>>
>> In other words, the need for the action setting (document.addCommonToCartForm.action='<@ofbizUrl>cancelOrderItem</@ofbizUrl>';)
>> should be checked and removed.
>>
>> -David
>>
>>
>> On Apr 6, 2009, at 12:55 AM, [hidden email] wrote:
>>
>>> Author: jleroux
>>> Date: Mon Apr  6 06:55:07 2009
>>> New Revision: 762224
>>>
>>> URL: http://svn.apache.org/viewvc?rev=762224&view=rev
>>> Log:
>>> A patch from Ashish Nagar "Secure URLs in Freemarker templates files" https://issues.apache.org/jira/browse/OFBIZ-2260
>>>
>>> Modified:
>>>    ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/order/orderitems.ftl
>>>
>>> Modified: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/order/orderitems.ftl
>>> URL:
>>> http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/order/orderitems.ftl?rev=762224&r1=762223&r2=762224&view=diff
>>> ==============================================================================
>>> ---
>>> ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/order/orderitems.ftl (original)
>>> +++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/order/orderitems.ftl Mon Apr  6 06:55:07 2009
>>> @@ -186,7 +186,7 @@
>>>                   </select>
>>>                   <b>${uiLabelMap.CommonComments}</b>
>>>                   <input class="inputBox" type="text" name="icm_${orderItem.orderItemSeqId}" value="" size="30"
>>> maxlength="60"/></div></td>
>>> -                  <td colspan="4" align="right"><a
>>> href="javascript:document.addCommonToCartForm.method='post';document.addCommonToCartForm.action='<@ofbizUrl>cancelOrderItem</@ofbizUrl>';document.addCommonToCartForm.submit()"
>>> class="buttontext">${uiLabelMap.CommonCancel}</a>
>>> +                  <td colspan="4" align="right"><a
>>> href="javascript:document.addCommonToCartForm.action='<@ofbizUrl>cancelOrderItem</@ofbizUrl>';document.addCommonToCartForm.submit()"
>>> class="buttontext">${uiLabelMap.CommonCancel}</a>
>>>                     <input type="hidden" name="orderItemSeqId" value="${orderItem.orderItemSeqId}"/>
>>>                   </td>
>>>               </tr>
>>>
>>>
>>
>