Log Message: |
"Applied fix from trunk for revision: 1422207"
------------------------------------------------------------------------
r1422207 | jleroux | 2012-12-15 10:15:37 +0100 (sam., 15 déc. 2012) | 32 lines
A patch from Naofumi Fukue for "javascript error in hidden form" https://issues.apache.org/jira/browse/OFBIZ-5098
HtmlMenuRenderer generates like bellow form tags. It generates double target="_BLANK" , then cause javascript error.
<li><form method="post" action="/ar/control/invoice.pdf" target="_BLANK" name="InvoiceSubTabBar_pdf_LF_8"><input name="invoiceId" value="8010" type="hidden"/></form><a target="_BLANK" href="javascript:document.InvoiceSubTabBar_pdf_LF_8.submit()">PDF</a></li>
document.InvoiceSubTabBar_pdf_LF_8 is undefined @ javascript:document.InvoiceSubTabBar_pdf_LF_8.submit()
jleroux: to reproduce
For example, edit applications/accounting/webapp/accounting/WEB-INF/controller.xml like this.
<request-map uri="invoice.pdf">
<security https="true" auth="true"/>
<event name="test" type="java" path="org.ofbiz.webapp.event.TestEvent" invoke="test"/> <= add this
<response name="success" type="view" value="InvoicePDF"/>
</request-map>
And in invoice screen, click 'PDF' button. Exist or not exist above line, generated html is different.
As is
~event: PDF rendered
<li><a target="_BLANK" href="/ar/control/invoice.pdf?invoiceId=8010">PDF</a></li>
event: PDF not rendered
<li><form method="post" action="/ar/control/invoice.pdf" target="_BLANK" name="InvoiceSubTabBar_pdf_LF_8"><input name="invoiceId" value="8010" type="hidden"/></form><a target="_BLANK" href="javascript:document.InvoiceSubTabBar_pdf_LF_8.submit()">PDF</a></li>
patched
~event: PDF rendered
<li><a target="_BLANK" href="/ar/control/invoice.pdf?invoiceId=8010">PDF</a></li>
event: PDF rendered
<li><form method="post" action="/ar/control/invoice.pdf" target="_BLANK" name="InvoiceSubTabBar_pdf_LF_8"><input name="invoiceId" value="8010" type="hidden"/></form><a href="javascript:document.InvoiceSubTabBar_pdf_LF_8.submit()">PDF</a></li>
------------------------------------------------------------------------
|