I'm creating a form in Vue having validation of Vee-validate. I want to make field blank on submit. But it is giving an error when I make the field blank on submit.
Can someone please help me to sort out it?
Thanks
You can add a small portion of code which describes better your problem.
But you can do this with Vee-validate after submitting your form
this.yourField = ''
this.$validator.reset()
Related
Im new to shopify and i have a question about forms.
There is a custom contact form in the theme. But on another page i wish to have a contact form with much more inputs. Before i start building anything. Is it possible to just create a form with the HTML block?
Thanks!
This documentation might help you:
https://shopify.dev/themes/customer-engagement/add-contact-form
Please check optional inputs part to get more info on how to add custom inputs.
Firstly you need to create a template file and this template you can call in cms pages in Shopify I think it's helpful for you
I'm also new here
As you already know; the contact form, build with the CF7 plugin, can not be submitted when using Safari and when the contact form contains a file upload button. The problem only occurs when the user is leaving the upload field blank, so without selecting a file.
For me, the best solution for this problem is to remove the file upload button when there is no file selected. I've partly succeeded in doing this through the following Jquery script:
jQuery(document).on('submit', '.wpcf7-form', function (e) {
jQuery('input.wpcf7-file').each(function() {
if (jQuery(this).val() == '') jQuery(this).remove();
});
});
There is only one problem left… When the form is submitted with the upload field left blank, the button is being removed but the spinning arrow icon keeps spinning and nothing happens. ONLY, when the user is submitting the form for a second time, the submission will succeed.
So I want to expand the code shown above with a few lines which is automatically submitting the contact form a second time in case the file upload field is left blank. Because of this the user would not have to submit the contact form twice which can be VERY confusing…
Can someone help me out with this? I think this is also a good solution for many other users because I have read many topics from people having the same problem.
Thanks in advance & have a nice day!
Best regards
I think your problem stems from the fact that the "submit" method is firing after the form submission starts (or at least after the form fields are collected). So on a second click it re-submits the form without the empty fields.
I've implemented a version of your script but binding to the click on the submit button, rather than the submit method of the form. So far - it seems to be working.
I experimented with making it only trigger on the affected browses (using nagivator.userAgent.match()) but without much luck in the brief time I'm looking.
<script>
jQuery(document).on('click', '.wpcf7-form [type=submit]', function (e) {
jQuery('input.wpcf7-file').each(function() {
if (jQuery(this).val() == '') jQuery(this).remove();
});
});
</script>
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
Ok, I'm having issues with my Test Runner where it is filling out the fields on the form but when I then submit the forms it refers to these fields as blank.
If I write to the field using element('some_element).val('some_val') this works fine.
If I then check the field with expect(element('some_element').val()).toBe('some_val') it passes without any problem
BUT
If I submit this form, it returns saying all these elements are empty. However I can change just one character manually and it accepts it without any issues.
Could anyone explain what would cause such an issue? And also any possible solutions on how to get round it?
The issue was with KendoUI and not the test runner.
If anyone can help me that would be great. I'm trying to submit any changes without getting the...
"A potentially dangerous Request.Form value was detected from the client.
I'm using tinyMCE with my project and if I enter any content that has any HTML characters I get the above message
I have tried various solutions here on Stackoverflow and elsewhere but they didn't work for me. The last solution I tried was here
Another site that looked promosing but without luck...
I haven't done any development for a while so I'm a tad rusty and not sure what you'll need until you ask.
Thank you
Use Request.Unvalidated to reference your textarea in your code block:
var html = Request.Unvalidated("myTextArea");
If you want to output whatever the user submitted, and you wanted the browser to respect the HTML markup that is included, you need to use Html.Raw:
You entered: #Html.Raw(html)