Disable predictive text on iPhone for a form field - iphone

Is there an attribute which I can specify for an <input> element which would turn off the predictive text functionality for this given field?
Something along the lines
<input type="text" predictive="disabled" />

There are some options:
<input type="text" autocomplete="off" autocorrect="off" autocapitalize="off">

On a per form field basis you can always do the following:
<input type="text" autocorrect="off" />

From the user side you can
Settings > General > Keyboard >
Auto-Correction On/Off.
from the app side, i don't think it can be done.

Related

Is there a way to label the Go button in iPhone Safari?

When focus is placed into an input of this form, iPhone shows input keyboard and Go button, which acts as submit. Is it possible to change the label to e.g. "Create"? I tried value, title or name but none of those work.
<form>
<input name="foo" type="text"/>
<input type="submit" name="Create" value="Create" title="Create"/>
</form>
No, something like this is not possible.

How to detect which submit button was clicked when the names are unknown?

I know how to detect which submit button was clicked when I know the name values of each of the buttons. But what if the names are dynamic or defined by another component?
For example, here I can simply check the POST data from this <form> for either alpha or bravo:
<form>
<input type="submit" name="alpha" value="Alpha">
<input type="submit" name="bravo" value="Bravo">
</form>
But that's only because I know I should be looking for those names.
Is there a best practice for handling this type of situation? (Perhaps by rendering an element <input type="hidden" name="submit-button-names" value="dynamic_name1|dynamic_name2|etc">.) I would like a solution that doesn't require JavaScript.
Presuming you have control over the JSP displaying these buttons, just prefix the button names with a string you can look for in the POSTed data. For example prepending "dynamicbutton_" to all of the names like this
<form>
<input type="submit" name="dynamicbutton_alpha" value="Alpha">
<input type="submit" name="dynamicbutton_bravo" value="Bravo">
</form>
Then in your Servlet, look for values with this prefix by calling ServletRequest.getAttributeNames()
You could write a custom tag to set the different inputs to your form based on a list of parameters you give to the tag.
You would end up with the HTML looking something like this:
<form method="POST" action="SelectColour.do">
<p>Select your favorite colour: </p>
<formTags:select name='colour' size='1' optionsList='${applicationScope.colourList}'/>
<input type="SUBMIT" value="Click here to submit">
</form>
Here's a decent guide to creating custom tags.

input buttons and 508 compliance: do they really need labels?

Does a button with a value really need a matching label tag in order to be 508 compliant?
Say I have:
<label for="search_box" class="hideme">search query</label>
<input type="text" id="search_box">
<input type="button" id="search" value="Search">
The web accessibility testing software is flagging it since it has an id but no matching label? Is it really necessary?
A <label> is not needed for <input type="button">, you need to provide a value attribute. If the button is using an image versus text, you need to provide an alt to be compliant.
<input type="button" src="....jpg" alt="Search" id="...">

Binding multiple text boxes with multiple submitt buttons in same form

I have a form where I have a search functionality with a text box(TextBox1) and a submitt button(Button1). Apart from search, there is another set of textbox(TextBox2) and submitt button(Button2). When I write something in search box(TextBox1), and hit enter, the validation message of the second textbox(TextBox2) is shown.
I am not sure how to bind the respective textboxes with submitt buttons. Please help.
Thanks in advance
Depending on how much control you have, the easiest way would be to have separate forms for each texbox/button combo.
<form action="dosomething.php">
<input type="text" name="foo" />
<input type="submit" />
</form>
<form action="dosomethingelse.php">
<input type="text" name="bar" />
<input type="submit" />
</form>
If you can't or don't want to do that, you'll need to look at handling the onkeydown event on the text boxes to prevent an automatic submission. Something like <input type="Text" name="foo" onkeydown="doSubmit(this); return false;" />. Note the return false;, which prevents the default action from taking place.

iPhone web applications and specific input types

I remember seeing a tutorial a while back on this but am unable to re-Google it.
Supposedly there is a way to get Safari on the iPhone to give keyboards other than the default. It went something along the lines of this, where certain keywords in the input name attribute triggered it...
This would give the default keyboard:
<input type="text" name="normal_text" />
This would give the number entry keyboard:
<input type="text" name="blah_blah_zip" />
This would give the number entry keyboard:
<input type="text" name="blah_blah_email" />
Does anyone know if this is still an available feature, and if so, what the keywords for triggering it are? Thanks!
The Safari for iPhone How-To's indicate this is still possible with a different syntax.
Text: <input type="text" /> <!-- display a standard keyboard -->
Telephone: <input type="tel" /> <!-- display a telephone keypad -->
URL: <input type="url" /> <!-- display a URL keyboard -->
Email: <input type="email" /> <!-- display an email keyboard -->
Zip Code: <input type="text" pattern="[0-9]*" /> <!-- display a numeric keyboard -->
Note:
To display a numeric keyboard, set the value of the pattern attribute to "[0-9]*" or "\d*".