struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lukasz Lenart (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (WW-4317) datetimepicker does not work where form theme=simple
Date Sun, 13 Apr 2014 15:49:15 GMT

    [ https://issues.apache.org/jira/browse/WW-4317?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13967869#comment-13967869
] 

Lukasz Lenart commented on WW-4317:
-----------------------------------

I think the problem is related to web.xml configuration, I prepared a simple demo and everything
works as expected:
https://github.com/lukaszlenart/struts2-jetty-demo

> datetimepicker does not work where form theme=simple
> ----------------------------------------------------
>
>                 Key: WW-4317
>                 URL: https://issues.apache.org/jira/browse/WW-4317
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Dojo Tags
>    Affects Versions: 2.3.15.3
>         Environment: Windows 8. Tomcat 6.0.39
>            Reporter: Patrick Kelly
>              Labels: datetimepicker, dojo
>             Fix For: 2.3.18
>
>
> I am in the middle of upgrading a webwork app to struts2 2.3.15.3. The good news is that
datetimepicker works just like I would expect it in hundreds of places across the migrated
application but only if the form is theme=xhtml. However if the form is simple (which it is
in this case), then what used to work "auto magically" in webwork seems a little more troublesome
in struts 2. There is some critical step I am missing but am yet to figure it out.
> This is what I am doing. The page uses an iterator to populate a list (of invoice items
under an invoice) and then allows the user to edit any item in the list by clicking an "Edit"
link that appears for each item in the list.
> The <td> cell for the "Edit" link looks like:
> {code:html}
> <td class="evenRow">
> <a <%=linkmouseover%> href="javascript:editInvoiceItem('<s:property value="id"/>',
'<s:property escape="false" value="providerHtml"/>', '<s:property value="createDate"/>',
'<s:property value="serviceCode"/>', '<s:property escape="false" value="serviceDescriptionHtml"/>',
'<s:property value="units"/>', '<s:property value="cost"/>', '<s:property value="gstApplies"/>',
'<s:property value="taxInclusive"/>');">Edit</a>
> </td>
> {code}
> And the javascript editInvoiceItem that gets called looks like:
> {code:javascript}
> function editInvoiceItem(id, provider, createDate, serviceCode, serviceDescription, units,
cost, gstApplies, taxInclusive) {
>        document.getElementById("invItemId").value = id;
>        document.getElementById("provider").value = provider;
>        document.getElementById("createDate").value = createDate;
>        document.getElementById("code").value = serviceCode;
>        document.getElementById("desc").value = serviceDescription;
>        document.getElementById("units").value = units;
>        document.getElementById("cost").value = cost;
>        document.getElementById("gstApplies").value = gstApplies;
>        document.getElementById("taxInclusive").value = taxInclusive;
>        units=units.replace(/\$|\,/g,'');
>        cost=cost.replace(/\$|\,/g,'');
>        calculateLineItem();
> }
> {code}
> And the theme=simple form that is auto populated when the user clicks "Edit" looks like...
> {code:html}
> <s:form theme="simple" id="itemAdd" name="itemAdd" action="invoice"
> method="post">
>      <s:hidden name="cmd" value="addItem" />
>      <s:hidden name="objType" />
>      <s:hidden name="objId" />
>      <s:hidden name="model" />
>      <s:hidden name="invId" value="%{invoice.id}" />
>      <s:hidden name="invoice.thirdPartyName" />
>      <s:hidden name="invoice.thirdPartyAddress" />
>      <s:hidden name="invoiceItem.id" id="invItemId"/>
>      <s:hidden name="invoiceItem.provider" id="provider" value="addItem"/>
>      <s:hidden name="role" />
> <tr>
>      <td class="evenRow"><sx:datetimepicker id="createDate" displayFormat="%{getText('dateFormat')}"
name="invoiceItem.createDate" /></td>
>      <td class="evenRow"><s:select id="code" emptyOption="true" name="invoiceItem.serviceCode"
list="invoiceCodes"/></td>
>      <td class="evenRow"><s:textfield id="desc" size="20" name="invoiceItem.serviceDescription"/></td>
>      <td class="evenRow"><s:textfield onchange="calculateLineItem()" id="units"
size="4" name="invoiceItem.units"/></td>
>      <td class="evenRow"><s:textfield onchange="calculateLineItem()" id="cost"
size="6" name="invoiceItem.cost"/></td>
>      <td class="evenRow"><s:textfield id="gst" size="4" readonly="true" name="invoiceItem.gst"/></td>
>      <td class="evenRow"><s:textfield id="total" size="6" readonly="true" name="invoiceItem.total"/></td>
>      <td class="evenRow"><s:select onchange="calculateLineItem()" name="invoiceItem.gstApplies"
id="gstApplies" emptyOption="false" list="#{'Yes':'Yes', 'No':'No'}"/></td>
>      <td class="evenRow"><s:select onchange="calculateLineItem()" name="invoiceItem.taxInclusive"
id="taxInclusive" emptyOption="false" list="#{'No':'No', 'Yes':'Yes'}"/></td>
>      <td class="evenRow">&nbsp;</td>
>      <td class="evenRow"><s:submit theme="simple" align="left" value="Save"
> /></td>
> </tr>
> </s:form>
> {code}
> There are 2 problems:
> - the field "createDate" is not populated when the user clicks the "Edit" link (while
all the other non-date fields referenced in the javascript are)
> - and if I manually enter a new date via the datetimepicker widget and click a button
to save the updated invoice item data, then I get a validation error saying the "createDate"
field is missing 
> Lukasz suggested I insert theme=dojo in the datetimepicker tag (<sx:datetimepicker
theme="dojo" .../>) but when I do this it throws an error "Attribute theme invalid for
tag datetimepicker according to tld"  



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message