Hi all,

  is there a way of setting which one is the default button when hitting Enter 
on a form?  I've tried looking for Wicket or Javascript solutions, I can't seem 
to find something that will post the correct button on the form - it's always 
the first one in the markup.

  The closest I've got was:
--------------------------------------
        function submitEnter(myfield,e) {
                var keycode;
                if (window.event) {
                        keycode = window.event.keyCode;
                } else if (e) {
                        keycode = e.which;
                } else {
                        return true;
                }
                if (keycode == 13) {
                        document.forms['searchForm'].searchButton.click();
                        return false;
                } else {
                        return true;
                }
        }
...
    <button wicket:id="browseButton" type="submit">Browse</button>
...
    <input wicket:id="searchTerm" maxlength="100" size="45" type="text" 
onKeyUp="return submitEnter(this, event);" />
...
    <button wicket:id="searchButton" type="submit" 
id="searchButton">Search</button>
...
-----------------------

  I've tried both <button> and <input type="submit">, both with the same 
result.  Wicket still reports the post as being done from the other button.  
Below is the page's code that deals with the buttons:
        add(new Button("searchButton") {
                protected void onSubmit() {
                        search();
                }
        });
        add(new Button("browseButton") {
                protected void onSubmit() {
                        browse();
                }
        });

  From there, I just have a log that prints info that came from the form (which 
seems to have been updated correctly).

  I'm using Firefox 1.5, Wicket 1.1.

  Are there any obvious mistakes?  Is there a way to do this?  I could resort 
to using Javascript to manipulate some hidden input...

  Thanks!

  []s Gus





-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to