Customize form/input in validation in HTML 5 [duplicate] - html

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
HTML5 form required attribute. Set custom validation message?
in HTML 5 form validation
<form>
<input type="txt" required id="username"/>
</form>
this required filed will always shows the message "Please enter filed"
Is there a way to customize this message ?

Not all browsers will support this attribute, Firefox does support it, IE and chrome no.
I dont know about the other browsers.
using value="Your value" mentioned above won't work. i just tried it.
i guess we have to wait till HTML5 becomes stable. to find out

<input type="txt" required id="username" value="Your value" />

Related

Disable auto fill of input tag in html? [duplicate]

This question already has answers here:
How do you disable browser autocomplete on web form field / input tags?
(101 answers)
Closed 3 years ago.
I have a webpage taking a new user name & password as input. For scripting, I am using AngularJS.
<div class="form-group">
<input ng-model="prc.userName" placeholder="User Name" type="text" class="form-control" autocomplete="nope" required autofocus />
</div>
This input box always gets auto-filled, I don't want it to get auto-filled.
Question reviewed prior: How do you disable browser Autocomplete on web form field / input tag?
// These attributes do not work
autocomplete="off"
autocomplete="false"
My chrome version: Version 73.0.3683.103 (Official Build) (64-bit)
How can I do that?
Yes this is a known error and it can be really annoying. for some reason autocomplete='false' and autocomplete='off' aren't working at all in chrome.
The only known method to get rid of it is to use autocomplete='new-password', this will deactivate the autocomplete!
Cheers
Add autocomplete="off" onto (form) element;
Add hidden (input) with autocomplete="false" as a first children element of the form.

Disable Google Chrome Autocomplete / Autofill / Suggestion [duplicate]

This question already has answers here:
Disabling Chrome Autofill
(68 answers)
Closed 5 years ago.
I want to disable google chrome autocomplete / autofill / use password suggestion Something similar with autocomplete="off" (this one is not working).
The code is as following
loginpage.php
<form class="form-method" method="post">
<span class="form-fill">
<text>Username</text>
<input placeholder="Username" required/>
<text>Password</text>
<input type="password" placeholder="Password" required/>
<button type="submit"></button>
</span>
</form>
anotherform.php
<form method="REQUEST" class="vp-method">
<input type="password" maxlength="4" autocomplete="JUST STOP!"/>
<button type="submit" placeholder="DVN Number">Validate</button>
</form>
How to disable this google chrome autocomplete / suggestion / autofill WITHOUT using javascript?
Note : I'm aware of duplicating question. And none of those suggestion is working (as I'm typing right now).
Thank you :)
Chrome no longer supports autocomplete="off". Use autocomplete="new-password"instead.
Mozilla link
From the documentation:
For this reason, many modern browsers do not support
autocomplete="off" for login fields:
If a site sets autocomplete="off" for username and password input fields,
then the browser will still offer to remember this login, and if the
user agrees, the browser will autofill those fields the next time the
user visits the page. This is the behavior in Firefox (since version
38), Google Chrome (since 34), and Internet Explorer (since version
11).
If an author would like to prevent the autofilling of password fields
in user management pages where a user can specify a new password for
someone other than themself, autocomplete="new-password" should be
specified, though support for this has not been implemented in all
browsers yet.
Another solution is using autocomplete="false". Here are a few links to other SO questions that may help:
SO - Disabling Chrome Autofill
SO - Chrome Browser Ignoring AutoComplete=Off
SO - Chrome 63+ Autocomplete Bypass
I tried to confuse the browser so that it wouldn't know which input field to fill, and this seems to be cross platform - can't test it on explorer thouth...
Try this, or something along these lines:
<input type="password" class="bigText login" name="hiddenFieldToStopBrowserAutofill" style = "height : 0px; width : 0px; border : 0px"/>
From what I saw, it only works if you specify the same class as another of the fields in the form ( in this case i have "bigText login" for both password and email address ) and then make it invisible in the way I described above. If you try to use "display = none" instead, it won't work.
I also tried some variations of value = "", value = " " and so on to stop the browser replacing the string with what it wants to force on the page, but it didn't work... Saves you time trying that if you were hoping for a cleaner opton

HTML5 <input> required attribute but not inside <form> [duplicate]

This question already has answers here:
html5 input type required without a form. Does it work?
(3 answers)
Closed 7 years ago.
The Required attribute works great inside the form Tags:
<form>
<input type="text" name="user" required>
</form>
But can I use the required attribute if I cannot wrap it as a form? Outside of the form this input required does not work for me:
<input type="text" name="user" required>
I can replicate it with JavaScript but Id like to know if outside form is possible
The "required" attribute only works on form submit and since your input has no form the browser does not know what to validate on submit.
What the w3c says about "required":
When present, it specifies that an input field must be filled out before submitting the form.
This would only be possible with JS like:
document.getElementById('your_input_id').validity.valid
Already discussed here 4 years ago:
html5 input type required without a form. Does it work?

Turn off Chrome/Safari spell checking by HTML/css [duplicate]

This question already has answers here:
Disable spell-checking on HTML textfields
(7 answers)
Closed 2 years ago.
Is there a way for a web developer to turn off Chrome/Safari/WebKit's spellchecking on particular input or textarea elements? I mean either by special tag attribute or a proprietary CSS instruction.
There is a CSS instruction for turning off outlining of inputs so I thought that might also exist. I know how a user can do it.
Or, as a user, can I disable it for some particular domain?
Yes, there is the HTML5 spellcheck attribute.
<textarea spellcheck="false"> or <input type="text" spellcheck="false">
http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#spelling-and-grammar-checking
Update: This is now supported in the latest versions of all browsers.
This works in Safari 7.1 and should work also in others:
<input autocomplete="off" autocorrect="off" autocapitalize="off"
spellcheck="false"/>
Only spellcheck="false" didn't work.
for all elements of a form it is possible and so:
<form spellcheck="false" .. />
In React, you gotta use spellCheck instead.
<input spellCheck={false} type="text"/>
Regarding outlining of input tags: don't do it, it's a visual cue for users.
But if you must:
#your-input{outline:none;}

How to disable Chrome spell check on INPUT with HTML or jQuery code? [duplicate]

This question already has answers here:
Disable spell-checking on HTML textfields
(7 answers)
Closed 2 years ago.
I have an input in an HTML page
<input id="SearchBox" type="text" value="" width="300px"
title="Search the card pool" autocomplete="off" maxlength="170">
I would like to switch this off with something like autospellcheck="off". Is there a way to achieve that?
Is there also a way to switch this off for Firefox?
Use the spellcheck attribute:
<textarea spellcheck="false"></textarea>
See Spellcheck (MSDN) or Controlling spell checking in HTML forms (MDN).
add the attribute using JQuery $('.textarea_className').attr('spellcheck',false);
I was able to do this with JQUery so that I can return 0 errors for my XHTML validation