You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Zied Hamdi <ja...@gmail.com> on 2008/09/15 14:22:35 UTC

[tomahawk] [tobago] js error schedule doesn't get the correct name of the form

Hi,

I have a js error when I click on a schedule entry:
document.forms[formId] has no properties
http://localhost:8080/IntoServicesWeb/faces/myFacesExtensionResource/org.apache.myfaces.renderkit.html.util.MyFacesResourceLoader/12214782/schedule.HtmlSchedule/javascript/schedule.js
Line 33

The value of formId is "page" where it should be "page:form"

I know tobago 1.0.x has a "different" handling of this structure (tc:page
defines a form without adding a HtmlForm to the tree view if my memory is
good) that's why I flagged this mail with [tobago] too. The thing is that I
have an old version of tomahawk 1.1.7 snapshot that works fine.

here's my tempslate
<html
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:jsp="http://java.sun.com/JSP/Page"
    xmlns:tc="http://myfaces.apache.org/tobago/component"
    xmlns:tx="http://myfaces.apache.org/tobago/extension"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core">
<f:view>
    <tc:loadBundle
        basename="into-i"
        var="i18n" />
    <tc:page
        label="#{i18n.pageTitle}"
        id="page"
        applicationIcon="/img/Into.gif"
        height="1300px"
        width="1400px">
        <head>
        <title><ui:insert name="title">#{i18n.pageTitle}</ui:insert></title>
        </head>

        <tc:panel>
            <f:facet name="layout">
                <tc:gridLayout
                    marginLeft="10px"
                    marginRight="10px"
                    columns="250px;*"
                    rows="70px;15px;*;15px" />
            </f:facet>

            <tc:cell spanX="2">
                <ui:insert name="header">
                    <ui:include src="/header.xhtml" />
                </ui:insert>
            </tc:cell>

            <tc:cell spanX="2">
                <ui:insert name="menu">
                    <ui:include src="/menu.xhtml" />
                </ui:insert>
            </tc:cell>

            <tc:cell>
                <ui:insert name="navigation">
                    <ui:include src="/navigation.xhtml" />
                </ui:insert>
            </tc:cell>

            <tc:cell id="pageContent">
                <ui:insert name="content">
                </ui:insert>
            </tc:cell>

            <tc:cell spanX="2">
                <ui:insert name="footer">
                    <ui:include src="/footer.xhtml" />
                </ui:insert>
            </tc:cell>
        </tc:panel>
    </tc:page>
</f:view>
</html>

the resulting page starts with
<form name="page::form" action="/IntoServicesWeb/contract/contract.jsf"
id="page::form" method="post" accept-charset="utf-8">

Any idea on how I could resolve this?

Regards,
-- 
Zied Hamdi
www.into-i.fr
(previously in 2003)
zatreex.sf.net

Re: [tomahawk] [tobago] js error schedule doesn't get the correct name of the form

Posted by Zied Hamdi <ja...@gmail.com>.
Hi,

I forgot I have the answer:

In fact that was in a preceding mail some 6 months and I forgot it (shame on
me)

Here is the solution : in the file
tomahawk-1.1.7.jar\org\apache\myfaces\custom\schedule\resource\javascript\schedule.js


you must replace the method fireEntrySelected implementation by this snippet

function fireEntrySelected(formId, scheduleId, entryId) {
      var form = document.forms[formId];
      if (form == null || form.tagName != "FORM") {
          form = document.forms[formId + "::form"];
          form[scheduleId].value = entryId;
          Tobago.submitAction(scheduleId);
          return true;
      }
      form[scheduleId].value = entryId;
      form.submit();
      return true;
}

Regards,
Zied

2008/9/15 Zied Hamdi <ja...@gmail.com>

> Hi,
>
> I have a js error when I click on a schedule entry:
> document.forms[formId] has no properties
>
> http://localhost:8080/IntoServicesWeb/faces/myFacesExtensionResource/org.apache.myfaces.renderkit.html.util.MyFacesResourceLoader/12214782/schedule.HtmlSchedule/javascript/schedule.js
> Line 33
>
> The value of formId is "page" where it should be "page:form"
>
> I know tobago 1.0.x has a "different" handling of this structure (tc:page
> defines a form without adding a HtmlForm to the tree view if my memory is
> good) that's why I flagged this mail with [tobago] too. The thing is that I
> have an old version of tomahawk 1.1.7 snapshot that works fine.
>
> here's my tempslate
> <html
>     xmlns="http://www.w3.org/1999/xhtml"
>     xmlns:jsp="http://java.sun.com/JSP/Page"
>     xmlns:tc="http://myfaces.apache.org/tobago/component"
>     xmlns:tx="http://myfaces.apache.org/tobago/extension"
>     xmlns:ui="http://java.sun.com/jsf/facelets"
>     xmlns:h="http://java.sun.com/jsf/html"
>     xmlns:f="http://java.sun.com/jsf/core">
> <f:view>
>     <tc:loadBundle
>         basename="into-i"
>         var="i18n" />
>     <tc:page
>         label="#{i18n.pageTitle}"
>         id="page"
>         applicationIcon="/img/Into.gif"
>         height="1300px"
>         width="1400px">
>         <head>
>         <title><ui:insert
> name="title">#{i18n.pageTitle}</ui:insert></title>
>         </head>
>
>         <tc:panel>
>             <f:facet name="layout">
>                 <tc:gridLayout
>                     marginLeft="10px"
>                     marginRight="10px"
>                     columns="250px;*"
>                     rows="70px;15px;*;15px" />
>             </f:facet>
>
>             <tc:cell spanX="2">
>                 <ui:insert name="header">
>                     <ui:include src="/header.xhtml" />
>                 </ui:insert>
>             </tc:cell>
>
>             <tc:cell spanX="2">
>                 <ui:insert name="menu">
>                     <ui:include src="/menu.xhtml" />
>                 </ui:insert>
>             </tc:cell>
>
>             <tc:cell>
>                 <ui:insert name="navigation">
>                     <ui:include src="/navigation.xhtml" />
>                 </ui:insert>
>             </tc:cell>
>
>             <tc:cell id="pageContent">
>                 <ui:insert name="content">
>                 </ui:insert>
>             </tc:cell>
>
>             <tc:cell spanX="2">
>                 <ui:insert name="footer">
>                     <ui:include src="/footer.xhtml" />
>                 </ui:insert>
>             </tc:cell>
>         </tc:panel>
>     </tc:page>
> </f:view>
> </html>
>
> the resulting page starts with
> <form name="page::form" action="/IntoServicesWeb/contract/contract.jsf"
> id="page::form" method="post" accept-charset="utf-8">
>
> Any idea on how I could resolve this?
>
> Regards,
> --
> Zied Hamdi
> www.into-i.fr
> (previously in 2003)
> zatreex.sf.net
>



-- 
Zied Hamdi
www.into-i.fr
(previously in 2003)
zatreex.sf.net