Hey Juan,
Few things to change to make it works.
1. <form>
To block to call onsubmit of the form, add
onsubmit="event.preventDefault()". And then call your method ...
doSearch(). like this:
<form name="searchform" onsubmit="event.preventDefault();doSearch();">
2. Remove the onsubmit in the input tag like this:
<input type="text" name="Search_Term" onkeypress=
"submitenter(event)">
Now, the form code should be like this now:
<form name="searchform"
onsubmit="event.preventDefault();doSearch();">
<input type="text" name="Search_Term"
onkeypress= "submitenter(event)">
<img name="button" img src = "ball-1.png" width="35"
height="32"align = "middle" value="検索" onClick="doSearch()">
</form>
I tested it and it works. Go ahead and try.
On Jul 10, 1:27 pm, juan_in_nippon <[EMAIL PROTECTED]> wrote:
> Here is the form code I am using:
>
> <form name="searchform">
> <input type="text" name="Search_Term" onsubmit = "return doSearch()"
> onkeypress= "return submitenter(event)">
> <img name="button" img src = "spotlight.png" width="35"
> height="32"align = "middle" value="検索" onClick="doSearch()">
> </form>
>
> And the actual url is here:http://www.passport-i.com
>
> Again the problem is: Can't quite figure out the keyboard event passed
> when a user clicks the Search button on the iPhone soft keyboard.
>
> Any other suggestions appreciated!
>
> On Jul 9, 1:15 pm, Costa Chung <[EMAIL PROTECTED]> wrote:
>
> > You can use event.preventDefault() to prevent the default action taken
> > by the form. Like this:
>
> > <form action="" method="get" accept-charset="utf-8"
> > onsubmit="event.preventDefault();doSearch();">
> > <input type="search" id="search_field" name="searchfield"/>
> > </form>
>
> > On Jul 8, 8:07 pm, juan_in_nippon <[EMAIL PROTECTED]> wrote:
>
> > > This might be a really stupid question but ... I trap the Enter &
> > > Return keys to pass asearchitem from a form using this javascript
> > > function
>
> > > function submitenter(event)
> > > {
> > > var keycode;
> > > if (window.event) keycode = window.event.keyCode;
> > > else if (e) keycode = e.which;
> > > else return true;
>
> > > if (keycode == 13) // ASCI keycode id for enter & return
> > > {
> > > doSearch(); // Ajax basedsearchroutine
> > > return false;
> > > }
> > > else
> > > return true;
>
> > > }
>
> > > My question:
>
> > > How would one alter this code to trap the iPhone'sSearchbutton? In
> > > other words, what is the iPhone'sSearchbutton keycode or onClick
> > > property?
>
> > > Thanks for any suggestions in advance!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"iPhoneWebDev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/iphonewebdev?hl=en
-~----------~----~----~----~------~----~------~--~---