You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Mike Kienenberger <mk...@gmail.com> on 2007/03/02 19:10:46 UTC

SubmitOnEvent doesn't work as child of h:selectOneMenu without explicit id

SubmitOnEvent doesn't work as child of h:selectOneMenu without
explicit id.  If 'id="choiceInput"' is removed from the example code
below, no submit occurs.

    <sandbox:subForm id="choiceForm"

        <h:selectOneMenu id="choiceInput"
            value="#{page.choice}">

           <f:selectItems
                value="#{page.choiceList}"/>

            <sandbox:submitOnEvent
                for="executeChoiceSelected"
                event="change" />

        </h:selectOneMenu>

        <h:commandButton id="executeChoiceSelected"
            style="display:none"
            value="Submit">
        </h:commandButton>

    </sandbox:subForm>

Re: SubmitOnEvent doesn't work as child of h:selectOneMenu without explicit id

Posted by Mike Kienenberger <mk...@gmail.com>.
Not sure if this is relevent, but there are some errors when I first
load the page, even though there's no errors when I select a row.

=========================================
Error: clear_masterForm is not defined
Source File: http://localhost:8089/faces/pages/connect.xhtml
Line: 1

Error: Selector expected.  Ruleset ignored due to bad selector.
Source File: http://localhost:8089/faces/pages/connect.xhtml
Line: 140

Error: inputComponent has no properties
Source File: http://localhost:8089/pages/submitOnEvent.js
Line: 80
=========================================

I'm not sure what control-shift-reload is -- my keyboard is missing that key :-)

But I tried holding down control-shift while hitting the reload button
with the mouse.  No difference.  Tried the same thing while choosing
reload from the menu.  No difference.

Doesn't seem like there'd be anything cached since I've only had the
one copy of the submitOnEvent.js installed.

On 3/2/07, Mario Ivankovits <ma...@ops.co.at> wrote:
> Hi Mike!
> > Yes, it looked reasonable to me as well.   I'm using firefox 1.5.0.10.
> >  Let me see if I get any errors.  Nope.  no javascript errors.
> >
> > Trying in IE 6.  Yep. works here.   So it's a firefox compatiblity
> > issue.   Does that help?    :-)
> Unhappily no, as I use firefox 95% the day, so I did for the test, and
> it works here.
>
> Not that I really think it has something to do with it, but maybe there
> is something bad in your browser cache.
> Please try "Ctrl-Shift-Reload", this should refetch all resources,
> regardless if its in the cache.
>
> Wondering,
> Mario
>
>

Re: SubmitOnEvent doesn't work as child of h:selectOneMenu without explicit id

Posted by Mario Ivankovits <ma...@ops.co.at>.
Hi Mike!
> Yes, it looked reasonable to me as well.   I'm using firefox 1.5.0.10.
>  Let me see if I get any errors.  Nope.  no javascript errors.
>
> Trying in IE 6.  Yep. works here.   So it's a firefox compatiblity
> issue.   Does that help?    :-)
Unhappily no, as I use firefox 95% the day, so I did for the test, and
it works here.

Not that I really think it has something to do with it, but maybe there
is something bad in your browser cache.
Please try "Ctrl-Shift-Reload", this should refetch all resources,
regardless if its in the cache.

Wondering,
Mario


Re: SubmitOnEvent doesn't work as child of h:selectOneMenu without explicit id

Posted by Mike Kienenberger <mk...@gmail.com>.
Yes, it looked reasonable to me as well.   I'm using firefox 1.5.0.10.
  Let me see if I get any errors.  Nope.  no javascript errors.

Trying in IE 6.  Yep. works here.   So it's a firefox compatiblity
issue.   Does that help?    :-)


On 3/2/07, Mario Ivankovits <ma...@ops.co.at> wrote:
> hi!
> > Here's what the non-working html contains:
> >
> > setTimeout("orgApacheMyfacesSubmitOnEventRegister('change','','masterForm:connectPageForm:chooseMemberForm:_id48','masterForm:connectPageForm:chooseMemberForm:executeChoseMember');",
> >
> > 0)
> >
> > </script>
> > <select size="1"
> > name="masterForm:connectPageForm:chooseMemberForm:_id48">
>
> So this looks good to me.
> Do you use IE or firefox? Do you see any javascript error? In firefox
> the web deverloper plugin comes in handy for this, but for sure, you'll
> have it installed, no?
>
> Ciao,
> Mario
>
>

Re: SubmitOnEvent doesn't work as child of h:selectOneMenu without explicit id

Posted by Mario Ivankovits <ma...@ops.co.at>.
hi!
> Here's what the non-working html contains:
>
> setTimeout("orgApacheMyfacesSubmitOnEventRegister('change','','masterForm:connectPageForm:chooseMemberForm:_id48','masterForm:connectPageForm:chooseMemberForm:executeChoseMember');",
>
> 0)
>
> </script>
> <select size="1"
> name="masterForm:connectPageForm:chooseMemberForm:_id48">

So this looks good to me.
Do you use IE or firefox? Do you see any javascript error? In firefox
the web deverloper plugin comes in handy for this, but for sure, you'll
have it installed, no?

Ciao,
Mario


Re: SubmitOnEvent doesn't work as child of h:selectOneMenu without explicit id

Posted by Mike Kienenberger <mk...@gmail.com>.
On 3/2/07, Mario Ivankovits <ma...@ops.co.at> wrote:
> Ok, its getting hot now, there is a difference between your two html
> snippets:
>
> not working
> > <select size="1"
> > name="masterForm:connectPageForm:chooseMemberForm:_id48">
>
> working
> > <select size="1"
> > name="masterForm:connectPageForm:chooseMemberForm:memberInput"
> > id="masterForm:connectPageForm:chooseMemberForm:memberInput">
>
> As you can see, the first lacks the id.

Well, yes.   That's what I'd expect to see.   On the working one, I
have id="memberInput" and on the non-working one, I've deleted that
value.   So the two are equivalent.   Or are you saying that there
should be a id="masterForm:connectPageForm:chooseMemberForm:_id48"?



> Though, the last version of submitOnEvent uses getElementsByName, though
> from the java script error in your last pos I see that you must use
> another version of it.
>
> > I manually copied it into my project on Jan 24th, though.
> There must be something went wrong, only the first version dated with
> 10.10.2006 used getElementById by accident.
>
> So, you should be able to fix this problem when you copy the latest
> version of submitOnEvent.js in your project.
> But I guess it's simply load it from your old sandbox jar, no? So you
> might replace it from within.

No, there's no submitOnEvent.js in my sandbox.   I had to manually add
it elsewhere to my project and point to it manually.   That's why I
get these errors :-)

15:17:12.375 ERROR! [SocketListener0-1]
org.apache.myfaces.renderkit.html.util.MyFacesResourceLoader.serveResource(MyFacesResourceLoader.java:143)
>16> Unable to find resource resource/submitOnEvent.js for component
submitOnEvent.SubmitOnEventRenderer. Check that this file is available
in the classpath in sub-directory /resource of the package-directory.

I will go ahead and grab the latest version of this from svn and copy
it into my project and let you know if anything changes.

Re: SubmitOnEvent doesn't work as child of h:selectOneMenu without explicit id

Posted by Mike Kienenberger <mk...@gmail.com>.
Hey Mario.

Thanks for taking the time to step through this with me.  You are
correct -- the version I had was quite different from the version in
trunk.   The bug goes away once I upgrade to the new version.  I must
have downloaded the wrong version by mistake.



On 3/2/07, Mario Ivankovits <ma...@ops.co.at> wrote:
> Hi!
>
> Ok, its getting hot now, there is a difference between your two html
> snippets:
>
> not working
> > <select size="1"
> > name="masterForm:connectPageForm:chooseMemberForm:_id48">
>
> working
> > <select size="1"
> > name="masterForm:connectPageForm:chooseMemberForm:memberInput"
> > id="masterForm:connectPageForm:chooseMemberForm:memberInput">
>
> As you can see, the first lacks the id.
> Though, the last version of submitOnEvent uses getElementsByName, though
> from the java script error in your last pos I see that you must use
> another version of it.
>
> > I manually copied it into my project on Jan 24th, though.
> There must be something went wrong, only the first version dated with
> 10.10.2006 used getElementById by accident.
>
> So, you should be able to fix this problem when you copy the latest
> version of submitOnEvent.js in your project.
> But I guess it's simply load it from your old sandbox jar, no? So you
> might replace it from within.
>
> Ciao,
> Mario
>
>

Re: SubmitOnEvent doesn't work as child of h:selectOneMenu without explicit id

Posted by Mario Ivankovits <ma...@ops.co.at>.
Hi!

Ok, its getting hot now, there is a difference between your two html
snippets:

not working
> <select size="1"
> name="masterForm:connectPageForm:chooseMemberForm:_id48">

working
> <select size="1"
> name="masterForm:connectPageForm:chooseMemberForm:memberInput"
> id="masterForm:connectPageForm:chooseMemberForm:memberInput">

As you can see, the first lacks the id.
Though, the last version of submitOnEvent uses getElementsByName, though
from the java script error in your last pos I see that you must use
another version of it.

> I manually copied it into my project on Jan 24th, though.
There must be something went wrong, only the first version dated with
10.10.2006 used getElementById by accident.

So, you should be able to fix this problem when you copy the latest
version of submitOnEvent.js in your project.
But I guess it's simply load it from your old sandbox jar, no? So you
might replace it from within.

Ciao,
Mario


Re: SubmitOnEvent doesn't work as child of h:selectOneMenu without explicit id

Posted by Mike Kienenberger <mk...@gmail.com>.
My copy of the sandbox is so old, it doesn't even have the component :-)

I manually copied it into my project on Jan 24th, though.

Here's what the non-working html contains:
======================================
<script type="text/javascript">

function chooseMemberForm_submit() {
var form = document.forms['masterForm'];
var el = document.createElement("input");
el.type = "hidden";
el.name = "org.apache.myfaces.custom.subform.submittedId";
el.value = "chooseMemberForm";
form.appendChild(el);
form.submit();
}

</script>
<script type="text/javascript" language="JavaScript">

setTimeout("orgApacheMyfacesSubmitOnEventRegister('change','','masterForm:connectPageForm:chooseMemberForm:_id48','masterForm:connectPageForm:chooseMemberForm:executeChoseMember');",
0)

</script>
<select size="1" name="masterForm:connectPageForm:chooseMemberForm:_id48">
<option value="com.gvea.utilities.web.jsf.converter.NULL_OPTION_VALUE">

&lt; Choose member &gt;

</option>
<option value="63">

Member #3456

</option>
<option value="83">

Member #8034

</option>
</select>
<input type="submit"
onclick="clear_masterForm();if(window.getScrolling!=undefined){document.forms['masterForm'].elements['autoScroll'].value=getScrolling();}"
value="Go!" name="masterForm:connectPageForm:chooseMemberForm:executeChoseMember"
id="masterForm:connectPageForm:chooseMemberForm:executeChoseMember">
======================================

Here's what the working html contains:
======================================
<script type="text/javascript">

function chooseMemberForm_submit() {
var form = document.forms['masterForm'];
var el = document.createElement("input");
el.type = "hidden";
el.name = "org.apache.myfaces.custom.subform.submittedId";
el.value = "chooseMemberForm";
form.appendChild(el);
form.submit();
}

</script>
<script type="text/javascript" language="JavaScript">

setTimeout("orgApacheMyfacesSubmitOnEventRegister('change','','masterForm:connectPageForm:chooseMemberForm:memberInput','masterForm:connectPageForm:chooseMemberForm:executeChoseMember');",
0)

</script>
<select size="1"
name="masterForm:connectPageForm:chooseMemberForm:memberInput"
id="masterForm:connectPageForm:chooseMemberForm:memberInput">
<option value="com.gvea.utilities.web.jsf.converter.NULL_OPTION_VALUE">

&lt; Choose member &gt;

</option>
<option value="63">

Member #3456

</option>
<option value="83">

Member #8034

</option>
</select>
<input type="submit"
onclick="clear_masterForm();if(window.getScrolling!=undefined){document.forms['masterForm'].elements['autoScroll'].value=getScrolling();}"
value="Go!" name="masterForm:connectPageForm:chooseMemberForm:executeChoseMember"
id="masterForm:connectPageForm:chooseMemberForm:executeChoseMember">
======================================

On 3/2/07, Mario Ivankovits <ma...@ops.co.at> wrote:
> Hi Mike!
> > SubmitOnEvent doesn't work as child of h:selectOneMenu without
> > explicit id.  If 'id="choiceInput"' is removed from the example code
> > below, no submit occurs.
> Strange thing, I tested it now with the following thing
>
>         <h:selectOneMenu
>                 value="#{configuratorData.selectedComponent}">
>             <f:selectItems
>                     value="#{configuratorData.components}" />
>             <s:submitOnEvent
>                     event="change"
>                     for="showPieces" />
>         </h:selectOneMenu>
>
> and it worked. At least with the latest sandbox.
> AFAIK you use a older version of the sandbox, is this true for this
> project too? Maybe I changed something in the meantime.
>
> If not, could you please check if the submitOnEvent javascript code has
> been rendered to the html, must look like something like:
>
> setTimeout("orgApacheMyfacesSubmitOnEventRegister('change','','_idJsp14:_idJsp19','_idJsp14:showPieces');", 50)
>
>
> Thanks!
>
> Ciao,
> Mario
>
>

Re: SubmitOnEvent doesn't work as child of h:selectOneMenu without explicit id

Posted by Mario Ivankovits <ma...@ops.co.at>.
Hi Mike!
> SubmitOnEvent doesn't work as child of h:selectOneMenu without
> explicit id.  If 'id="choiceInput"' is removed from the example code
> below, no submit occurs.
Strange thing, I tested it now with the following thing

        <h:selectOneMenu
                value="#{configuratorData.selectedComponent}">
            <f:selectItems
                    value="#{configuratorData.components}" />
            <s:submitOnEvent
                    event="change"
                    for="showPieces" />
        </h:selectOneMenu>

and it worked. At least with the latest sandbox.
AFAIK you use a older version of the sandbox, is this true for this
project too? Maybe I changed something in the meantime.

If not, could you please check if the submitOnEvent javascript code has
been rendered to the html, must look like something like:

setTimeout("orgApacheMyfacesSubmitOnEventRegister('change','','_idJsp14:_idJsp19','_idJsp14:showPieces');", 50)


Thanks!

Ciao,
Mario