Hi all

I've got a webapp working with struts 1.0.2 and tiles, but there is now a requirement 
to make the enter button on the keyboard work.

My problem is that my pages have the following code on them which creates two submit 
button objects.  The user types an entry into some text fields on the form and then 
presses enter.  The behaviour at the moment is that either nothing happens or the 
first button defined on the form in this case the cancel button is activated.

My question is how can I make the Enter button be the default on an enter keyboard 
press?  So far I have tried adding tabindex="0" to the code for the cancel button with 
no success.

    <tr> 
      <td colspan="3" width="41%" align="right"><html:cancel styleClass="formButton" 
value="Cancel" tabindex="0"/>&nbsp;<html:submit styleClass="formButton" 
property="submit" value="Enter" /></td>
      <td width="41%">&nbsp;</td>
      <td width="3">&nbsp;</td>
    </tr>

which generates the following HTML in the browser

    <tr> 
      <td colspan="3" width="41%" align="right"><input type="submit" 
name="org.apache.struts.taglib.html.CANCEL" value="Cancel" 
class="formButton">&nbsp;<input type="submit" name="submit" value="Enter" 
class="formButton"></td>
      <td width="41%">&nbsp;</td>
        <td width="3">&nbsp;</td>
    </tr>

Thanks

Nigel Vivian

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to