Enable autocomplete feature in aurelia single page application - single-page-application

We have enabled autocomplete property true for all input fields. We didn't use form tags in the templates. The input fields don't fetch the previously entered data. So how can we implement autocomplete property.

Firstly, this is not specific to Aurelia. Once the element is in the DOM, it is a feature of the browser to offer the user a previously entered value for that field given that an assumption can be made about what the field is supposed to be!).
Depending on the browser, the autofill feature relies on having 'known' input attributes (name and type) and possibly even the surrounding text, including label text.
If you are not getting the expected results, try making sure your inputs have very obvious name attributes, first. Eg.
<input type="text" name="email">
If you could share a snippet of code, I might be able to offer more help.

Related

What is a valid alt text for an image only submit button?

I'm researching a website for accessibility issues and I found an image only submit input field for a search field.
Code of this input field is.
<input type="submit" value="Search">
I'm wondering if, giving this input field a value name 'Search' is sufficient to pass as an alternative text for succescriteria 1.1.1?
The value attribute provides the accessible name and visual label for a submit input, so the example should be sufficient.
If an actual image-input was used, the alt attribute must be used to provide an accessible name:
<input type="image" alt="Search" src="…">
Otherwise, it depends on the way the text is replaced with the image, as CSS can influence whether something is accessible or not. If the input element itself is still visible and focusable, it’s fine. If the whole element is hidden, especially from assistive technology, it’s not.
You can verify by inspecting the magnifying glass element in your browser, or by inspecting the accessibility properties. The name should be exposed.

Can an input be "labeled" with a aria-labelledby instead of a <label>?

Is the following valid per WCAG 2.0?
<span id="my-label">Your photo</span>
<input id="my-upload" type="file" aria-labelledby="my-label">
The OS X screen reader understands this, e.g. reading the label for the input when it gets the focus, but Total Validator complains as follows:
You can try it yourself by running Total Validator on this page. Is Total Validator correct to report this error, or is this a bug in Total Validator?
(Obviously, in this particular example, I could use a <label for="my-upload">, instead of relying on the aria-labelledby. One could even argue that using a <label> has more semantic weight and should be prefered. But that is not the question I'm asking, as in my real-life scenario using a <label> can't be done.)
aria-labelledby is used to provide information to accessibility devices like screen readers. It won't be of any help if you do not use such specific device.
It won't give any information to 99% of people. So yes, Total Validator is correct to report this as an error as WCAG does not require to use a specific device. That being said, you can use the title attribute in situation where you can't use a label tag.
See: H65: Using the title attribute to identify form controls when the label element cannot be used
It is ok to use aria-labelledby as a way of creating an accessible name where a visible label already exists. It is better to provide a label association using for-id because that will allow clicking on the label text to place the focus in the input field (or select the checkbox or radio button).
Your accessibility analyzer is old. If you use the aXe accessibility analyzer, you will notice that it will not complain about this issue.

How to show wordpress setting api validation error message?

I have created a setting api for my new plugin. It has four <input> field and one <select> option. In that field , user can change value according to their requirement. But it must be valid value. Suppose , one <input> field support only integer value. so when user will fill that <input> field by string or by other things, it will show an error message. Please tell me how can i do that? Can you suggest any tutorial ?
When using add_setting you can pass a sanitize_callback option as part of the array, this can contain the name of a function that is run which can contain your validation.
A similar method exists for JavaScript too, which you could use to validate the fields as well.
You asked for a tutorial too, here is one that outlines the method I've described: http://themeshaper.com/2013/04/29/validation-sanitization-in-customizer/

HTML 5 Placeholder: when user selects field make text disappear

Is this possible to achieve without javascript/jQuery?
I currently have a login template with the input fields as:
<input id="username" type="text" name"username" placeholder="username" autofocus>
I was wondering if there was a way when the user clicked their mouse on the field to type the placeholder text would disappear without using javascript if possible? Before this i was just using value and echoing the variables out into the fields but currently experimenting with HTML 5 and CSS3.
Thanks.
New browsers have a native way to do this. And if supported, you don't have to do anything.
With older browsers you do need to use javascript.
Edit: When using new features on old browsers its called Pollyfills. Here is a nice list with a lot of pollyfills that can be used together with Modernizer, that in turn can detect this features.

ASP.NET hidden field vs. invisible textbox

what are benefits of using a hidden field in ASP.NET when we can use another invisible element such as label or text box?
The hidden field generate <input type="hidden" /> element on the page, which cannot be seen but the client can get the element, set the data and pass to the server:
document.getElementById('<%= SomeHiddenField.ClientID %>').value = "data_pass_to_server";
after postback you can get the value:
var clientData = SomeHiddenField.Value; // "data_pass_to_server"
If you're using invisible textbox (<asp:TextBox Visible="False" />), there's no element generated in the html file.
Either way works, for text box, don't use .visible="false"
use
yourTextBox.Style.Add("display", "none")
or
yourTextBox.Style.Add("visibility", "hidden")
A hidden field renders as input type="hidden" in the resulting HTML. Being an input the value in the input is submitted to the server on postback while this is not the case with a label. Depending on whether or not you want that value submitted to the server you should use input or label. If you don't want the value to be submitted then label is the right solution and hidden field is wrong.
I am not sure what you mean by invisible textbox but if you are trying to make it invisible via CSS keep in mind that the input type has semantic meaning to search engines, bots, etc. Also at some point your HTML might be served without CSS or with different CSS and the text box will become visible to the user. Otherwise there are no differences between hidden field and invisible text box as both of them render inputs.
Practically you can achieve the same thing with any of them, but since you want a "hidden field", semantically speaking the hidden field in ASP.NET is your best bet for readability reasons.

Resources