DOM Input elements should have autocomplete attributes - codeigniter-3

I have eror verbose
[DOM] Input elements should have autocomplete attributes (suggested: "current-password"): (More info: https://#) <input type=​"password" name=​"password" id=​"password" class=​"abs-form mtb-10" placeholder=​"Password" required>​
What the mean?

"autocomplete" determines what, if any, permission the browser has to provide automated help suggesting form field values. It also lets the browser know the type of information expected in the field.
For a password field, I would suggest autocomplete="off".
Give that a try and see if the verifier changes its mind. The other option would be to try autocomplete="current-password"
Complete details on "autocomplete" attribute HERE.

Related

Pre-populating form fields with model data in Sightly/HTL

I've tried all the HTL context parameters (even 'unsafe'). When I inspect the input, I can see the value intact, but you can't see the value pre-populated in the field. I tried different types of values, different contexts, and different types of input fields. [AEM 6.2]
<input type="email" name="senderEmail" value="${userProfile.email # context='text'}"/>
If the value is rendered in page source and also visible in browser inspector, could it be that it's hidden by some weird CSS? Something like color:transparent
There are many possible causes. I'll pitch in one, to help get you thinking. Is userProfile available via the use api?
I've made this mistake before:
<div data-sly-use.bean="com.beans.Bean">
${bean.value}
</div>
// ... other code
${bean.value}
The "Bean" isn't available later, outside it's host element.
If I understand your question correctly this isn't actually about HTL, but rather about the HTML input element itself. You have an input element with a value attribute set, yet that value is not displaying in the box. If that's correct, then I'd recommend doing some investigation around HTML input value not displaying when set, rather than sightly context issues.
Some possible answer would include css styles hiding the input text or javascript clearing out the values after page load. There are certainly more potential causes, but we'd need to know more about your page to provide a better answer.
To do some of your investigation you can try loading a component with only that input in it and see if that works, that would eliminate any css or js executing elsewhere on the page.

Parsley.js - Re-validate a field after selecting an auto-complete value or drag-and-drop

After parsley validation, an error message may be displayed near a field.
If the user types a corrected value, the field is automatically re-validated, the message will disappear, and the field will be marked with success.
However, if a valid value is then entered by either i) selecting from the field's "auto-complete" dropdown OR ii) by dragging-and-dropping into the field, this will not invoke the re-validation, and the error message remains even though the field now has a valid value.
Example...
Q: How to force fields to re-validate upon selecting value from the browser's auto-complete dropdown/drag-and-drop?
(I realise you can specify no auto-complete on fields, but this may not always be desirable, and doesn't solve the drag-and-drop issue.)
In autofill function add this code to validate the autofill fields again:
function autofill_function_name(){
your code;
$("#autofill_field_name").parsley().validate();
}
In my case, I use bootstrapValidator for validation.
Then, you have to revalidate the field after fetching data
$('yourForm).bootstrapValidator('revalidateField', 'inputName');

Is there a way to deliberately make a form field that doesn't submit?

A lot of folks on Stack Overflow are probably trying to fix forms that don't submit, but I'm actually hoping to do the opposite!
What I'd like to do for an art project is make a form with a "joke" field -- say, your SSN, your bank account number, your fingerprints or retina scans or DNA code, or something super personal like that. But I don't want the number in our server logs, and I don't want it to be transmitted over the internet at all. I don't want any legal liability!
Basically the idea is just to ask for something audacious, but not to handle the data that may or may not come from users who actually put it in.
So, is there a way to make a field that acts as a normal form field, but where nonetheless we would feel "safe" that users who actually do put their sensitive info in the field will be protected?
What's the "safest" approach to something like this?
Form fields require a name to be submitted:
If any of the following conditions are met, then skip these substeps for this element:
[…]
The field element is not an input element whose type attribute is in the Image Button state, and either the field element does not have a name attribute specified, or its name attribute's value is the empty string.
[…]
So you could simply use an input without name attribute:
<input type="text">
Be careful with your "jokes", if you want that the information of the field is not submitted, then, you can simply leave it out of the form element like this:
<form action="... >
<input type="... >
</form>
<input type="... > <!-- This field won't be submitted-->

HTML5 form validation: Default = invalid, is this normal behavior?

I am building a form using HTML5 form validation.
I have the CSS classes input:valid and input:invalid defined. Some of the input fields are marked as required, but not all of them. Is it normal that the fields that aren't marked as required are valid by default, meaning in my case have a green background? And is it normal that required fields are invalid by default?
If this is normal: Why did they make it that way? In my eyes it is not very user friendly to mark a field as valid oder invalid before something was entered. Is there anything I can do besides JavaScript?
Yes, it's normal behaviour. Whenever user entered anything or not, he should know that field, marked as required, will be invalid until he will enter anything that matches pattern (or just anything :) ).
If for some reason you don't like such behaviour - sorry, but you should use JavaScript.

Zend hidden elements: hide html values

I am facing a special scenario here on some of my forms.
I have settled a permission system over some fields many of which are required.
When removing the permission to view the field on a form, I set:
$field->setDecorators('disableLoadDefaultDecorators', true);
The problem in that case is that I get prompted with the validation error over the required field, which is logical.
The other option would be to set the $field to hidden but the issue turns to become an html problem where any person can retrieve the hidden value through the source code.
Hopefully someone can offer me a suggestion on how to hide the element from the form and metadata but return it on form validation as if it was displayed.
Thank you in advance!
Change the field validation rules so that it is not required:
$field->setRequired(false)->setDecorators('disableLoadDefaultDecorators', true);