Environment: cocoon cforms
Bug: IE7 doesn't submit form
Cocoon Version: 2.1.11
Container: Tomcat 6.0
OS X 10.4.8
JDK 1.5.0

IE7 - enter key doesn't submit single-field form
This is an IE7 bug.

http://forums.microsoft.com/MSDN/ShowPost.aspx? PostID=903924&SiteID=1&pageid=0
discusses this bug (not in relation to cocoon or cforms).

It mentions two workarounds

1. hidden input field

2. javascript to submeit form

        if(event.keyCode==13) document.forms[0].submit()
        
        <input type='text' onkeydown='if(event.keyCode==13) this.submit()'>
        
My results

1. hidden input field does nothing

2. javascript workaround has to be added to the widget. I see two possible ways to do this.

      <fd:on-keydown>
        <javascript>
                if(event.keyCode==13) document.forms[0].submit()
        </javascript>
      </fd:on-keydown>

        and
        
          <fd:attributes>
<fd:attribute name="onkeydown" value="if(event.keyCode==13) document.forms[0].submit()"/>
          </fd:attributes>
        
        Adding to the widget definition thus:

  <fd:widgets>
    <fd:field id="q" required="true">
      <fd:label>Search Terms:</fd:label>
      <fd:datatype base="string"/>
      <fd:validation>
        <fd:length min="2"/>
      </fd:validation>

      This

      <fd:on-keydown>
        <javascript>
                if(event.keyCode==13) document.forms[0].submit()
        </javascript>
      </fd:on-keydown>

      or this

          <fd:attributes>
<fd:attribute name="onkeydown" value="if(event.keyCode==13) document.forms[0].submit()"/>
          </fd:attributes>
        
    </fd:field>

Never changes the generated html code as displayed by view source in browser.

Thus 1. fails and I am unable to try 2.

My page had another form so I removed it resulting in no change in the behavior, so the bug occurs
with either 1 or 2 (possibly more) forms on the page.

Multi-field form does in fact succeed, so it appears that this specific bug is the one at issue.

Thanks in advance for your help.

Charles Rose
CogNet
MIT Press Journals




Reply via email to