You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Jan Zach <za...@centrum.cz> on 2006/04/12 01:18:52 UTC

commandLink vs. commandButton logic

Hi everybody!

Whenever I use a commandLink in the same form along with the inputHtml component, the commandLink does not work but commandButton does.
I'm not able to figure out the difference from the generated html mess...
Does anybody else encounter this?

A similar poblem found when a dialog window is open (tree component in my case) but this happens just for the first access to that url. I' ve described it in thread "jsf view init".

Thanks

Jan



Re: commandLink vs. commandButton logic

Posted by Jan Zach <za...@centrum.cz>.
I do not know the version I downloaded all jars about 1-1.5 month ago.... maybe I shoud mention that I use tiles also.

the code for htmlInput is

---------------------
<h:form>

    <t:div rendered="#{identity.admin &amp;&amp; pgEditor.edit}">

        <h:commandButton actionListener="#{pgEditor.cancel}" value="cancel"/>
       <%-- commandLink does not work here --%>

   <t:inputHtml
    id="page_editor"
    value="#{pgEditor.text}"
    allowEditSource="true"
    showPropertiesToolBox="false"
    allowExternalLinks="true"
    addKupuLogo="false"
    showLinksToolBox="false"
    showImagesToolBox="false"
    showTablesToolBox="false"
    showDebugToolBox="false"
    showCleanupExpressionsToolBox="false"
/>

        <h:commandButton
            image="/layout/img/flag/#{cmEditor.selectedLocale.name}.gif"
            style="width:36px; height: 18px;"
            actionListener="#{pgEditor.store}"
        />
</h:form>

---------------------------------------

and the tree in dialog:



<html>

<f:view>

    <head>
        <script type="text/javascript">
            function doSave(id, name, code)
            {
                var formId = window.openerFormId;
                var op = document.createElement("option");
                op.text = name;
                opener.document.forms[formId][formId + ":srv-category"].appendChild(op);
                var v = opener.document.forms[formId][formId + ":srv-category_ids"].value;
                v = (v == null || v.length == 0)? id: (v + "," + id);
                opener.document.forms[formId][formId + ":srv-category_ids"].value = v;
                   window.close();
            }
        </script>
    </head>

    <body>

        <h:form id="f_dir_category_tree_selector">

            <h:commandLink id="loc_expall"  value="Expand All" actionListener="#{dirEditor.category.expandAll}"/>

            <t:tree2 id="category_tree" value="#{dirEditor.category.treeData}"
                    var="node"
                    varNodeToggler="t" clientSideToggle="false" binding="#{dirEditor.category.tree}">

                <f:facet name="root">
                    <h:panelGroup>
                        <h:graphicImage value="/cc/img/files_box.gif" width="20px" height="20px"  />
                    </h:panelGroup>
                </f:facet>

                <f:facet name="0">
                    <h:panelGroup>
                        <t:graphicImage value="/layout/img/icon/yellow-folder-open.png" rendered="#{t.nodeExpanded}" border="0"/>
                        <t:graphicImage value="/layout/img/icon/yellow-folder-closed.png" rendered="#{!t.nodeExpanded}" border="0"/>

                        <h:panelGroup>
                            <z:commandLink id="edit_cat_0" onclick="doSave('#{node.id}', '#{node.description}');">
                                <h:outputText value="#{node.description}" styleClass="nodeFolder"/>
                            </z:commandLink>
                        </h:panelGroup>

                    </h:panelGroup>
                </f:facet>

            </t:tree2>

        </h:form>

    </body>

</f:view>

</html>

------------------------------

the dialog is open like:

    function doCategoryPopup(source)
    {
        popup = window.open("/cc/page/category.jsf", "Select Category", "scrollbars=yes,toolbar=no,menubar=no,location=no,width=400,height=500,modal,dialog,minimizable=false,top");
        popup.openerFormId = source.id.substring(0, source.id.lastIndexOf(":"));
        popup.focus();
    }




______________________________________________________________
> Od: mkienenb@gmail.com
> Komu:  "MyFaces Discussion" <us...@myfaces.apache.org>
> CC:  
> Datum: 12.04.2006 01:38
> Předmět: Re: commandLink vs. commandButton logic
>
>  What version of JSF are you using?
> 
> What does your page code look like?
> 
> 
> On 4/11/06, Jan Zach  wrote:
> > Hi everybody!
> >
> > Whenever I use a commandLink in the same form along with the inputHtml
> component, the commandLink does not work but commandButton does.
> > I'm not able to figure out the difference from the generated html
> mess...
> > Does anybody else encounter this?
> >
> > A similar poblem found when a dialog window is open (tree component in
> my case) but this happens just for the first access to that url. I' ve
> described it in thread "jsf view init".
> >
> > Thanks
> >
> > Jan
> >
> >
> >
> 


Re: commandLink vs. commandButton logic

Posted by Mike Kienenberger <mk...@gmail.com>.
What version of JSF are you using?

What does your page code look like?


On 4/11/06, Jan Zach <za...@centrum.cz> wrote:
> Hi everybody!
>
> Whenever I use a commandLink in the same form along with the inputHtml component, the commandLink does not work but commandButton does.
> I'm not able to figure out the difference from the generated html mess...
> Does anybody else encounter this?
>
> A similar poblem found when a dialog window is open (tree component in my case) but this happens just for the first access to that url. I' ve described it in thread "jsf view init".
>
> Thanks
>
> Jan
>
>
>