Magento CheckOut js validation error - javascript

I started to edit a magento template and I stumbled upon an error: if I miss a required field and click the submit button, the "this is a required field" text appears underneath the respective field; but when I recomplete the form and click the 'submit" button for the second time, I realise that it is blocked.
Has anyone gone through the same thing? I don't know javascript at all and I'm not able to do it myself.
Im in a great need of getting this done, so please, lend me a hand.

For anyone else who finds this question: I ran into this issue and after much debugging realised that it was because I had removed scriptaculous/effects.js from the layout of the checkout page.
The form validation JS depends on effects.js, but the code that uses it is inside a try/catch block meaning that you will not get console errors, and instead the form will just fail to revalidate correctly.

Take a look at this link it will give an explanation of the javascript validation in Magento. the thing to look for is the class in the text/select fields if it has required or any of the other ones listed in the link, it will run the validation through those.
http://fishpig.co.uk/magento-tutorials/magento-forms-prototype-javascript-validation

Related

Trying to automate reporting process on a website by using JavaScript

I want to automate submissions of TikTok copyright infringement reports with JavaScript. I have tried this code so far:
document.getElementsByName('name')[0].value = 'Name Here'
When I attempt to submit the form, the site clears the textbox and asks me to fill out this required field. Any clue what I am doing wrong? I have also tried this:
document.getElementsByName('name')[0].dispatchEvent(new Event('change'))
Without knowing exactly how that React form handles the input, it's hard to know what event needs triggering.
You can use Puppeteer to do this much easier, see this question for examples

Windows with space to write text dont appear AJS

I have created custom Issue Tab Panel with field, where I can add comment when Ill press my custom button “add comment”
In my VM template I have
AJS.$("#add-comment-button").click(function(e) {
e.preventDefault();
AJS.dialog2("#add-status-comment").show();
});
This button works fine and window to write text appears, but… In other section in Issues --> Current Search —> Views (Detail Views), windows with space to write text dont appear when I click button “add comment”. It only appers in normal view of issue… Whats problem?
I'm not sure if I understand your question right so I'll give it a try. Maybe it helps in one or the other way.
As you didn't provide the code affecting the window I assume it is possible you are retrieving the issue key or issue id. There are some Jira JS calls that don't work in every view. The reason is unknown to me, but maybe if you use different calls it will work.
Here is the question and answer to this field availability problem on the atlassian community: https://community.atlassian.com/t5/Jira-questions/Get-issueID-in-JavaScript-in-Project-Screen-viewing-issue/qaq-p/824175
Otherwise you should provide some more information.
Regards
Chris

Material-UI - Is it possible to make the AutoComplete control required?

I spent the better part of yesterday trying to make the AutoComplete control required. The API doesn't have a required attribute and onNewRequest doesn't fire if the textbox is blank, onBlur has a bug and doesn't work, and I'm not sure how to hijack handleSubmit (redux-forms-material-ui) to check if that field is empty. Also I put that control in the list of fields to validate but nothing fires for that control. What am I missing?
Shortly after writing this question I realized code another developer wrote was stepping on the validation. Nothing is wrong with making the control required field by passing it an error message if the control has no selection.

mailchimp modal integration "There are errors below" with bootstrap hidden-xs and visible-xs

I'm having issues with the modal mailchimp pop-up signup form on this website. (tip if you want to view more than once, delete your cookies).
I was trying to add another field besides email and somehow the form stopped submitting, so I reverted to the original code. However, after revering back to the original code, the popup was showing an error of "There are errors below" after the user submits his/her email. After further chrome console inspection, I noticed that if I delete the form with bootstrap's class visible-xs entirely and then remove the class hidden-xs from the other form, it seemed to clear things up.
The user can now submit his/her email on mobile or desktop. But I feel like there's something strange happening. Did mailchimp changing something and that broke the code or am I'm just missing something? I have the form with visible-xs commented out so you can see when you view source.
On top of this I'm trying to add another required location field. It's letting the users submit without selecting a location (even though it contains the html required attribute. Any ideas how to ensure the form isn't sumbitted without selecting a location field? (This is also current commented out so you can see it in the source code.)
Maybe someone has tips on best practices for all of this? Any idea why I have to delete one form for the whole thing to work? Any ideas to code this modal form better? Ideas to get the location field working? Thanks!

User account creation and validation (BigCommerce)

I'm having a little trouble with my account creation form.
first of all, my site is on 'BigCommerce', but they can't help me because i changed the design and they don't deal with design related issues.
The problem is like this:
If I fill every textbox with the right information and click submit, everything is just OK. I'm getting transferred to the 'Thank you' page, the new user is added and everything is just fine.
But, If I type something like a wrong E-mail address, Two not-matching passwords, leave some text box blank or something like that and click submit, the form is all blank and I have to start filling the details all over again.
second, I'm getting redirected to another page (with a new and empty form), and the error is written on the top on the form, instead of getting a pop-up message with what's wrong on the same page.
so.. this is the account creation page:
​
http://pastebin.com/pB5mrbtf
​
and the javascript code its redirecting to
http://pastebin.com/gLw5WCEQ
Please help
remove the autocomplete="off" for your text removing issue and for others pls attach jsfiddle link.
Also keep your old id's and class's for validation, otherwise you need to update your js file functions also. please provide jsfiddle link

Categories

Resources