You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Murray Brandon <mu...@hotmagna.com> on 2006/04/03 08:03:05 UTC

non-existent clear_myFormName() javascript method being called on button submit

Looking at the source of HtmlFormRendererBase it conditionally defines 
the javascript for clear_myFormNameHere( ), but HtmlButtonRendererBase 
always adds the call to the method onClick= regardless.  So I get a 
javascript error on my page when I click on a commandButton saying that 
clear_appform is not defined.

            <h:commandButton id="ue10" type="submit" value="Submit" 
actionListener="#{mob.selectedUser.processAction}" immediate="true">
                <f:param id="ue11" name="command" value="save"/>
                <f:param id="ue12" name="rule" value="editedUserSaved"/>
            </h:commandButton>

Have I missed something?

HtmlFormRendererBase.java
        //render hidden command inputs
        Set set = 
(Set)component.getAttributes().get(HIDDEN_COMMAND_INPUTS_SET_ATTR);
        if (set != null && !set.isEmpty())
        {
            HtmlRendererUtils.renderHiddenCommandFormParams(writer, set);

            String target;
            if (component instanceof HtmlForm)
            {
                target = ((HtmlForm)component).getTarget();
            }
            else
            {
                target = 
(String)component.getAttributes().get(HTML.TARGET_ATTR);
            }
            
HtmlRendererUtils.renderClearHiddenCommandFormParamsFunction(writer,
                                                                         
component.getClientId(facesContext),
                                                                         
set,
                                                                         
target);
        }

And HtmlButtonRendererBase.java

        //call the clear_<formName> method
        
onClick.append(HtmlRendererUtils.getClearHiddenCommandFormParamsFunctionName(formName)).append("();");

Regards, Murray