I have created two modals (loginModal and registerModal), where a user can switch between them dynamically.
There is an issue with the "VeeValidate" plugin, it's only validating the first field if I added something to the error bag.
I have created a demo for the problem here:
https://2o2z51km00.codesandbox.io/
Source:
https://codesandbox.io/s/2o2z51km00
Open loginModal (it will open by default).
Submit the default login info (you will see a "you have entered invalid
credentials" message).
Switch to register modal after seeing that message.
Submit register modal (with empty inputs)
As you can see, it highlight the first field only (full name field) while ignoring other fields.
Why does that happen?
After a lot of time spent, and not aware of recent changes in the later versions from 2.1 til 2.2.3.
The problem was having multiple modals trying to use the same names. This can be fixed by using scopes as i've implemented in a fork to your project.
https://codesandbox.io/s/vv0jqprpj0
So by adding too the input:
data-vv-scope="SCOPE"
And using this to validate the fields
this.$validator.validate('SCOPE.*')
A side note to this is that you were using v-show on the RegisterModal to show errors and v-if on the LoginModal - The correct is to use v-if
Related
I updated our version of self asserted to 2.1.2 to address the new password reset flow. Doing this has added the social_intro to our custom log in page.
I have added the local_intro_generic to the page and it works fine, However the social_intro still show up. We are not allowing for any social login and I don't want it displayed. I can edit it... but I don't see a way to hide it either in the documents or any other search.
You can edit the html file that is getting referenced for that page. Hide the divs that you don't need after checking the class names of the divs using inspect element.
ASP.net Core 2.2 MVC Web Application
I have a number of forms where I do NOT want the browser to cache/show any previous entered data when the user return to the page. I want the elements/form to NOT cache any information. I do not simply want the browser not to show previously entered information, I want it not to be cached for security reasons.
I tried decorating the controller method with:
[ResponseCache(NoStore = true, Location = ResponseCacheLocation.None)]
to no avail, when I again navigate to the page/form and start typing, previously entered values keep showing up as autocomplete options.
I've tried playing with every nuance of this as well:
Response Caching Middleware in ASP.NET Core
How is this done for all browsers nowadays?
Sounds like it is caused by the autocompletion feature of browser:
By default, browsers remember information that the user submits through fields on websites. This enables the browser to offer autocompletion (that is, suggest possible completions for fields that the user has started typing in) or autofill (that is, pre-populate certain fields upon load).
To disable this feature for a form:
<form autocomplete="off">
...
</form>
Or disable a field :
<input ... autocomplete="off">
Here's a detailed explanation on off
The "off" keyword indicates either that the control’s input data is particularly sensitive (for example the activation code for a nuclear weapon); or that it is a value that will never be reused (for example a one-time-key for a bank login) and the user will therefore have to explicitly enter the data each time, instead of being able to rely on the user agent to prefill the value for him; or that the document provides its own autocomplete mechanism and does not want the user agent to provide autocompletion values.
For more details, see how to disable autocompletion on MDN and w3c.org
Hope it helps.
You can use autocomplete="off" for html elements but chrome prevent this for some names like "name", "address" etc.
This topic was discussed earlier. Chrome ignores autocomplete="off"
I am testing my web application using Selenium. All the form validation in the web application is done by HTML5 and some JS(for safari browser). I want to know what is the proper way to test the form validation.
Currently I am using one approach, i.e Before I filled up a mandatory field I clicked on the submit button. If the page is not refreshed then I assume the form validation working correctly. But I think there should be a better approach to do it. I am unable to find any proper solution. Any suggestion will be highly appreciated.
I also go through this link. But it is not working for me because it is not enough to have required attribute (eg required attribute does not work in older Safari browser).
Rather than checking if the page is refreshed or not, you should instead expect that it is not and that a certain error message or field highlighting or something is applied to the current page. When in an error state, the input fields probably get given an extra class, or an error div/span might be added to the DOM, try checking for that sort of thing
Situation: I needed to add form with POST method to CMS page. I created custom hook and a module displaying the form successfully. Then I need to react to user input errors eg. when user doesn't enter email address I need to detect it, display the whole page again together with the form and with "errors" in user input clearly stated.
Problem: The problem is to display the WHOLE page again with connected information (eg. about errors etc.). In the module PHP file when I add this kind of code,
return $this->display(__FILE__, 'modulename.tpl');
it (naturally) displays ONLY the form, not the whole CMS page with the form.
In case of this code,
Tools::redirectLink('cms.php?id_cms=7');
I can't get to transfer any information by GET neither POST method.
$_POST['test'] = 1;
Tools::redirectLink('cms.php?id_cms=7&test');
I tried to assign to smarty variables too
$smarty->assign('test', '1');
(I need to use it in .tpl file where the form itself is created) but no way to get it work.
{if isset($test)}...,
{if isset($smarty.post.test)}...,
{if isset($_POST['test'])}... {* neither of these conditionals end up as true *}
Even assigning a GET parameter to url has no impact, because there is link rewriting to some kind of friendly url I guess, no matter I included other argument or not. ([SHOPNAME]/cms.php?id_cms=7&test -> [SHOPNAME]/content/7-cmspage-name)
My question is: is there a way to "redirect" or "reload" current page (or possibly any page generally) in prestashop together with my own data included?
I kind of explained the whole case so I'm open to hear a better overall solution than my (maybe I'm thinking about the case in a wrong way at all). This would be other possible answer.
The simplest method would be to use javascript to validate the form - you can use jQuery to highlight the fields that are in error; providing visual feedback on how the submission failed. In effect you don't allow the user to submit the form (and thus leave the page) until you're happy that the action will succeed. I assume that you will then redirect to another page once a successful submission has been received.
There's lots of articles and how-tos available for using javascript, and indeed jQuery for form validation. If you want to keep the site lean and mean, then you can provide an override for the CMS controller and only enqueue the script for the specific page(s) you want to use form validation on.
If the validation is complex, then you might be best using AJAX and just reloading the form section of your page via a call to your module. Hooks aren't great for this kind of thing, so you might want to consider using an alternative mnethod to inject your code onto the cms page. I've written a few articles on this alternative approach which can be found on my prestashop blog
Having upgraded an app (in progress) to 3.1 I had to change a test for clearing the password and password confirmation fields. Rather than testing for an empty value attribute I had to test for a missing value attribute.
That was fine, but when I went to turn off the field clearing to make the test fail, it still passed, because the fields were still cleared (the value was still missing). Previously I had lines in the appropriate controller under create to clear the fields if user creation failed (so the fields would be empty when the form was redisplayed). Now it appears that is no longer necessary.
Is this default behavior now for password and confirmation fields?
Yes.
From the changelog:
Rails 3.0.0 (August 29, 2010)
password_field renders with nil value by default making the use of passwords secure by default
And the original commit here.