I have text box that is in a partial and exists in a collection.
I added the required on the input box, when nothing is in the textbox and i hit submit shows field is required message and disables the form submit button. However, then when i go type something in the text box message field is required stays and form is still disabled.
I removed the novalidateattribute on the form in case that was causing this.
Related
When I open my website I want to automatically start typing in my form instead of the default browser search bar.
from the scren:
I want to start typing in the Google bar for example.
scrn
There is an autofocus attribute in Html 5
<input type="text" autofocus>
From MDN:
This Boolean attribute lets you specify that a form control should
have input focus when the page loads, unless the user overrides it
(e.g. by typing in a different control). Only one form element in a
document can have the autofocus attribute, which is a Boolean. It
cannot be applied if the type attribute is set to hidden (that is, you
cannot automatically set focus to a hidden control). Note that the
focusing of the control may occur before the firing of the
DOMContentLoaded event.
I have replaced my radio inputs by some label pictures and set the display of the input to "none;"
Now when I'm trying to validate a form without checking the radio inputs, I can't see the chrome "required message" to display, because the input radio is not displayed, how can I make the message appear (only with required attribute) on the labels instead of the input ?
Thanks
In my web page: which is a jsp file
I have an input text, I type a text in it then I press enter an error occurs:
javax.servlet.ServletException: Request[/myAction] does not contain handler parameter named 'method'. This may be caused by whitespace in the label
text.
What can be the cause?
If you hit enter in one of the text inputs, browsers will act like the first button on the form was pressed & IE will not send any button related information to the server.
To avoid it all and make one input act just like multiple inputs, just add a 'hidden' text input
<input type="text" style="display: none" />
This input will force IE to act like the first button on the page was clicked when enter is pressed on this form.
For further info, go to Click here
I have an input field that is filled in from a previous form(so the input is set to disabled on the second page) and we receive null for the value then. This works:
<input type="text" class="boxtpl" name="${field.name}" value="${user?.email}">
but this doesn't:
<input type="text" class="boxtpl" name="${field.name}" value="${user?.email}" disabled="disabled">
Is there a reason why this seems to break the framework?
Disabled controls shouldn't actually be submitted with the form, so what you're seeing is in fact normal behaviour. According to the HTML form specification:
When set, the disabled attribute has the following effects on an element:
Disabled controls do not receive focus.
Disabled controls are skipped in tabbing navigation.
Disabled controls cannot be successful.
The definition of successful can be found in the same document. It's a bit nonsensical to suggest that Play is broken because of this.
If you want to have a form field that user cannot edit while it should still be sent along when the form is submitted, you can use the read-only attribute, or use JavaScript to disallow user input.
Update: as pointed out in the comments, the following points may also offer a solution:
It's possible that Play still keeps the disabled control's form values in the request object, and just doesn't bind them (so you could retrieve them from the request if needed)
Use a hidden field to keep the form value in case you still want to submit the value, but do not want the user(s) to see the control
Can anyone explain this behavior? Pressing the Enter key in an HTML form's text box submits the form when the form contains a single text box, but not when the form contains two or more text boxes.
jsFiddle (one input): http://jsfiddle.net/gpPTa/
jsFiddle (two inputs): http://jsfiddle.net/fDbJt/
Unfortunately it's a default for the form to submit on enter with only one input.
You can either give each of them an javascript command that submits the form, or place a submit button with width: 0 and/or visibility: none.
For example:
<form>
<input style='width:0; visibility:hidden' type='submit'>
<input>
<input>
</form>
It seems that the browser assumes that since there is only one input, it is also the submit control. Focusing on it and pressing enter will submit the form, the same way as focusing on a submit button will behave.
When you add type="submit" to one of the <inputs>, you can use as many others as you like and the form will be submitted by pressing enter.
I don't have any references to back this up, but it seems logical to me.