In xhtml is this correct syntax of unchecked radio button - forms

In XHTML I know that this is correct for a checked radion button:
<input type="radio" checked="checked" name="bar" value="baz" />
And absence of the checked attribute means that the radio button is unchecked:
<input type="radio" name="bar" value="baz" />
But would this be correct for unchecked radio button as well:
<input type="radio" checked="" name="bar" value="baz" />

No actually using
<input type="radio" checked="" name="bar" value="baz" />
will also render the checkbox checked in the browsers i've seen (how strange it might look)!

Related

Mobile keyboard turn off input autosuggestion

how can I turn off autosuggestion strip above the mobile keyboard in Ionic?
I've already tried:
<input type="text" name="username" id="username"
class="form-control" placeholder="Enter your user name"
value=""
autocapitalize="off"
autocomplete="off"
spellcheck="false"
autocorrect="off" />
but none of these works.
The same problem persists for <ion-input>.

Flat-UI & AngularJS Radio Input Form Functionality

Using Flat-ui with a form that contains some radio inputs which changes the format from standard bootstrap <input type="radio"... format to the following:
<label class="radio">
<input type="radio" name="group1" value="1" data-toggle="radio">
Radio is off
</label>
<label class="radio">
<input type="radio" name="group1" value="2" data-toggle="radio" checked>
Radio is on
</label>
The problem is when I use AngularJS to process the form the values are not being stored in the associated object:
<label class="radio">
<input type="radio" name="group1" value="1" data-toggle="radio" data-ng-model="regForm.accountType">
Radio is off
</label>
<label class="radio">
<input type="radio" name="group1" value="2" data-toggle="radio" data-ng-model="regForm.accountType">
Radio is on
</label>
As an aside: The radios' images are not appearing until after they are toggled? Has anyone else has this problem with flat-ui's kit?
Here is solution for this problem.
https://gist.github.com/petehamilton/5993366
Another solution is to don't preventDefault event
https://github.com/designmodo/Flat-UI/issues/57

submit on enter multiple inputs

I have one input field that submits on pressing enter, like so:
<form action="" method="POST" >
<input type="text" name="name"/>
<input type="submit" style="display:none;" />
</form>
But when I add another field, pressing enter doesn't do anything:
<form action="" method="POST" >
<input type="text" name="name"/>
<input type="text" name="message"/>
<input type="submit" style="display:none;" />
</form>
Why not? How can this be resolved?
Thanks a lot!
I wouldn't use display:none.
I think you wanted visibility: hidden.
At any rate, I wouldn't use either. If you do not want a submit button I would first moved those / after the input names one space to the right and then use a hack suggested on SO.
<form action="index.php" method="POST" >
<input type="text" name="name" />
<input type="text" name="message" />
<input type="submit" style="position: absolute; left: -9999px;
width: 1px; height: 1px;"/>
</form>
Also, please check out this Question as it has some great Answers on it.
Submitting a form by pressing enter without a submit button

Strange IE form file select bug

I am making a simple image uploader. Since normal file selected cannot be styled do i use a bit of javascript to overcome this. There's just one problem, when someone using IE trys to upload a file by pressing the "fake" file select bar and press submit the selected image disappear. Do anyone know why this happens?
Try it for yourself
File score (same as in link above):
<form action="fileUploadBugIE.php" method="POST" enctype="multipart/form-data" character_set="UTF_8" >
<input type="text" readonly="readonly" id="filePath" onclick="document.getElementById('fileUL').click();" /><br /><br />
<input type="file" name="imageFile" id="fileUL" onchange="document.getElementById('filePath').value = this.value;"/><br />
<input type="submit" value="Submit" />
</form>

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.