MVC4 Remote Validation clashes with submit button - ajax

I have a remote validator setup on my text box which primarily checks if the data that the user enters is unique. I do understand this works on mouse out of the original control and does an AJAX call for the same.
My problem is that while this works fine while am tabbing between controls on my form containing like 6 other controls, if I am directly clicking on the submit button on my form, the request does not go across since the AJAX call for the remote validation is in progress, and the user would in this scenario have to click on the submit button twice to actually save the form.
Anyone come across this scenario?

I would suggest, leave your button disabled; and only enable if all of your validations have been passed. This way, your button will only be enabled once you have got the response back from the remote validation.

Related

Passing description from browser in elsa

In document workflow, after I reject/approve the document in the mail, I want it to take to the browser where I can add a comment in the comment box and then pass that comment back to the employee through email. How can it be done?
I have tried adding comments in console and pass it through mail.How can it be done in UI designer?
#vahidnaderi is spot-on:
In the workflow from where you send the email containing the approve/reject link(s), have these links point to a custom webpage you create.
This webpage contains 3 fields and a submit button:
A radiolist with an "approve" and "reject" radiobuttons
A "comments" textarea.
A "workflowinstanceid" hidden field that stores the workflow instance ID.
When the form is submitted to your backend application, you trigger a signal ("approve" or "reject") for the appropriate workflow instance ID and provide the comment as input.
Your workflow will resume and the received comment will be available as input to the first activity that comes after the "signal received" activity.
That activity should either be the "send email" activity or a "set variable" activity in case you want access to the received comment later in the workflow.
From the "send email" activity, you can now access the comment you wish to include with the email.
Obviously, you're completely free to do things differently. For example, perhaps you want a separate page for "approve" and another page for "reject".
The key takeaway here is that you provide your own web UI. This web UI then interacts with your application backend (i.e. by submitting a form to a controller), which then interacts with Elsa services to e.g. trigger workflows.

How to handle Stripe payment failure via AJAX, with standard page load for success? (using Laravel backend)

I've got a long and fairly complex form for a booking system that a user fills in, then pays using Stripe Checkout. I'm trying to figure out the best solution to both handle payment failure easily (so submitting form over AJAX so I don't have to try and regenerate the whole booking form with all the data the user's entered), whilst also handling payment success gracefully (so with a new page showing a booking summary and a different URL so if user clicks reload button in their browser it doesn't just take them back to the search results and booking form again)
I'm using a mixture of Laravel 5.4 and JS/JQuery to generate the booking form on the front end, and after Stripe Checkout (I'm using their standard simple integration pop up) it submits all the form + Stripe token etc back to a POST route in my Laravel backend. In my controller, I then try and charge the credit card using standard Stripe API and process the booking details into my database, and then return a Laravel view from a Blade template thus giving the user a different page and URL. As mentioned I want to switch the form submission to AJAX so payment failure can be handled easily (i.e. their big filled in form doesn't disappear, and just an alert pops up to user so they can try and enter a new card into the Stripe Checkout). That bit's fine, I'll just use this: https://stackoverflow.com/a/34099169/4059141 but then in payment succeeds I basically want the same behaviour as if I'd done a regular form POST, so the new page being displayed with a new URL.
I can generate and pass back the rendered HTML from the blade template over AJAX no problem, but that leaves the original URL in the browser's address bar, so if they hit reload on the booking summary they'll just see the search results page and blank booking form again - not what I want.
Any thoughts on a solution are welcome! Thanks

FineUploader On Leave Handling

We are developing a Single Page Application in which we have hash based routing, FineUploader seems to have a functionality where when the user clicks the Browser Back the Upload is canceled, how can we use it on navigation inside our app...
Fine Uploader does not cancel an in-progress upload when the user navigates away from the current page. Quite the contrary - it prevents the uploader from being accidentally canceled by popping up a confirm dialog. If you would like to cancel all uploads at any time, you can do so via the cancelAll API method.

Track button views and clicks as events in google analytics

I am trying to place a button that will be inside email and I want to track button views and clicks (Google Analytics events). Can you tell me if that is possible and how to do that?
You can't technically track a button click from an email, but what you can do is control where the button links to.
If you set the button's URL to point to your servers, you can intercept the link, send a hit to Google Analytics using the Measurement Protocol, and then redirect the user to where the button was originally pointing.
Alternatively, you could append custom campaign parameters to the end of the URL (utm_medium, utm_source, etc.). This would allow you to know what source the hit came from. Here's some information on custom campaigns:https://support.google.com/analytics/answer/1033863?hl=en
This is able to track button views by using Measurement protocol, and using UTM tagging to track sessions come from this button (but not actual clicks).

Sharepoint ItemAdding & ItemAdded issue

I need to retrieve an Infopath File, which is displayed and filled in on a sharepoint webpage, and save it's data to a seperate DB. There are 2 events that fire once the form is submitted. ItemAdding and ItemAdded.
I know that I can not retrieve the file from the ItemAdding Event because it only gets saved after the ItemAdding Event.
But I want to redirect users to a different website once I have stored my values to the database, but I find no way to do this. I guess, the problem is that the ItemAdded event occurs, after/or at the same time as the user gets redirected to the webpage showing "The form has been closed".
How can I retrieve the values and redirect the user? Also, I am not allowed to attach code to the infopath form itself. This needs to be handled from Sharepoint.
Thank you
If you are redirecting within the SharePoint site you can include "source" as a query string parameter.
You also try a response.redirect in the OnClose event of the infopath form.

Resources