I don't really know how to explain this one very well so here we go.
I am trying to implement the Stripe payment button on my page. When the submit button is click, the JS validates the users input. That said, I do not have access to the JS file.
I am trying to add the ability for users to choose weather to pay by check (in which the stripe form elements disappear and other appear related to paying by check).The problem is, when the user selects to pay by check and click submit, the validation checks for the stripe form are run, they of corse fail and the submit action is aborted.
So how, when the user selects check, can I disable the Stripe actions?
Thank you in advance for any help.
You should have different forms for the different payment methods, so that the Stripe form doesn't think it is being submitted.
Here's my guess as to how you could disable the listeners, anyway:
$("#payment-form").unbind('submit');
You have a couple different options. One would be to work with the event handlers in javascript when the user chooses to pay by check. Another option (probably simpler) option would be to have 2 submit buttons and show and hide them depending on how the user intends to pay.
Related
I have a form, where most fields are required. Once the form is submitted series of automated tasks gets initiated.
I want to provide users the ability to save their progress and come back and complete the form.
Cookies isn't a option, as users will be logged in to their account and should be able to continue their application from different devices.
The application is saved in the database. I need to do it in a way so that submit button submits the form, checks for all the required fields. (It does this currently).
I also need to have a save progress button which will ignore the validation and just save the data currently filled. ( No automated tasks etc should run when form is saved using this button.).
Is there a way to achieve this? If so how do i go about it?
The solution above may not be the right / most effective solution. I'm open to any other suggestion.
Thank You
On the second button you can use the formaction attribute.
Please note this works only on for buttons with type="submit". Then you can send the save progress info to a different page then just store the info.
<button type="submit" formaction="saveprogress.php">Save Progress</button>
If you are having two submit buttons, 1. Submit and 2. Save Progress, then it will be very easy.
Add onClick action on Submit button to validate the form, and after complete validation(return true for correct validation) you can save the data in database.
And on Save progress, just on click of button, you can directly save the data into database.
You need to make the changes in database schema. Add one more column(is_validated), to specify whether the data is validated or not for the user(As mentioned by you, you are firstly logging in user in your application).
When you are fetching data again, you can show the form according to is_validated flag.
I have never noticed that ASP.NET automatically shuts down all subsequent postbacks until the field that validated as false is fixed by the user.
My scenario:
I have a form with 3 fields. One of them is a Textbox (txtCarName) with a required field validator and then I have a dropdown(ddlCarMake) with AutoPostBack=true, that filters and enables another dropdown (ddlCarModel) OnSelectedIndexChange.
Lets say the user clicks the save button without filling out the required textbox (txtCarName). They will be notifed that it is a required field.
Before they go and add a value to the required textbox lets say they decide to edit the ddlCarMake because they change their mind. In this case the filter does not happen since all subsequent postbacks are disabled. The user would be extremely confused.
How do ASP.NET developers avoid something like this from creating a poor user experience?
UPDATE:
After contacting Telerik they told me this is a known issue and is currently fixed in their internal build. The next release it will be fixed.
set the dropdownlist CausesValidation="False"
We have a required field on a page where the user has to select Gender which is a radio button with options Male and Female.
What we are finding is that there are cases when the entity has no gender stored in the database. There is javascript on the page
that does not allow user to leave the page without selecting a value. I am trying to figure out if there is a way to find out
continue without selecting a value. Would anyone be able to provide some insight as how it can be done ?
If I disable the javascript the page does not even submit. So there is another way that the user is able to skip a required field. Any ideas ?
Thanks in advance.
It's a good idea to have a back-end form validation check, as well as front-end. That way if users disable JavaScript, or find ways to bypass the front-end form validation check, the back-end will also check the form for errors.
Also, you can just set a default for the radio button, by adding the checked="checked" attribute to any of the radio button genders. This way the user will have a gender radio button already selected by default.
You may also add the <noscript></noscript> tags to your page to check if the user has JavaScript enabled. If the user does not have JavaScript enabled, your page can display a message that the user needs to enable Javascript to use your site.
More info here: http://www.w3schools.com/tags/tag_noscript.asp
It could be done using development tools (like the one we get by pressing F12 on Google Chrome) in modern browsers. As the validation is done through javascript, ie client side, a user can manipulate it from the browser.
I currently have two forms doing two separate actions.
One form subscribes a user to a mailchimp list. The other allows a user to submit their cv.
However I have two submit buttons, one for each action. I want to condense this down to just one submit.
Here is my jsfiddle: http://jsfiddle.net/GSVY8/
.
The end result should be that on submission the CV should be sent to me, and then the form for mailchimp should be submitted.
Any ideas would be much appreciated.
Cheers, Matt
You are using two different actions, so you need to different forms! Without the tag, the input button is useless anyway!
Validate the form in both client-side and server-side
So just wrap each submit button in a different form with a different action/validation and you're done!
I am looking for a script that will block or remove an order button to prevent customers from double or triple ordering but clicking the button more then once. I don't know what something like this would be called. But the site was developed in Classic .asp. However I'm going to guess and say this would be javascript or jquery on an image button? Any suggestion or points for this would be a big help!!!!
Thanks,
Having seen your comment on ianpgall's answer, I think the best solution would be a server-side check of the customer's order.
When they click the button and submit the form, check to see if they have already added the product to their basket. If they have you can either choose not to add it again, or ask the user to confirm.
This allows users to click the button more than once if they want to, and also prevents adding the product erroneously if the user has javascript disabled.
I think you're referring to "disabling" the button. For example:
<input type="button" id="button1" value="Submit" />
$("#button1").click(function () {
this.disabled = true;
});
If you're using AJAX, you can disable the button when it's clicked, then remove the attribute when the AJAX completes.
UPDATE:
Just as a reminder, this will only work if the user has Javascript enabled. That's a pretty safe thing to expect, but I just wanted to let you know. If it's not enabled, I'm not sure how else to prevent multiple clicks, without enforcing the user to have Javascript enabled. If this is a serious problem, you may want to look into that.
You can disable the submit button once it has been clicked, which will prevent this in most cases. There are so many ways of doing this in JavaScript and jQuery.
This is one simple example using jQuery. It will disable any SUBMIT buttons in a form once the form has been submitted, preventing the submit button being pressed again.
<script type="text/javascript">
$("form").submit(function(){
$(this).find('input[type=submit]').attr("disabled", "disabled");
});
</script>
If you also want to protect against the user clicking back and submitting again then you need a different solution based on ASP sessions or cookies.