Yii make submit disabled when post is processing - validation

Is any way to do it with Yii framework: make submit disabled, after validating success and sending form to server?
I need it to stop multi submitting (double, tripple clicking on submit button).
Thanks!

No, this functionality is not built in to the CActiveForm code by default.
I just tackled this problem, actually, and ended up having to override CActiveForm to use a custom version of jquery.yiiactiveform.js. I thought about rolling it up into an extension, but it's pretty custom so it would be tough, and I'd have to re-release it with every new Yii release if they change jquery.yiiactiveform.js at all.
After seeing your post here, I did just file an enhancement request with Yii:
http://code.google.com/p/yii/issues/detail?id=2924
Attached to that request is the code I wrote if you want to try and use it yourself.
Good luck!

Related

TYPO3 v8 Form framework submitting form with ajax

Is there a way to configure the TYPO3 core Form framework to submit a form with ajax?
I already tried to submit the whole form, but i think that the honeypot or another security feature prevent it from submitting directly.
Is there any simple solution to fix this?
Since this question ranks fairly high when searching for 'typo3 forms framework ajax', this link might help you with this task, finally:
https://www.comuno.net/blog/detail/formular-mit-typoscript-rendering-per-ajax-verschicken/

AEM OOTB Form Component and AJAX Submission

I'm evaluating AEM 6.2 OOTB forms component to build a Newsletter signup form with AJAX submission, this is not AEM Forms that is licensed separately.
https://docs.adobe.com/docs/en/aem/6-2/develop/components/developing-forms.html
I have not used this component previously, can someone advise on the following:
Can I make the form submit request via AJAX and capture response from the server side / API (asynchronous)?
Is there limitation in terms of styling capability? I'm trying to achieve the same signup form at the bottom of this page https://westernstarbutter.com.au/en/recipes/ham_-cheese-and-veggie-bake.html
Any other limitations / gotchas that I should be aware of?
Would love to hear some advices on this, would be great if someone can share some implementations as well.
Thank you!
Can I make the form submit request via AJAX and capture response from the server side / API (asynchronous)?
I don't believe you can do this OOTB - it's certainly not part of the actions list but it wouldn't be too hard to create a custom action and add the necessary Javascript code to hook into the form submission.
Is there limitation in terms of styling capability?
Not really - just add your own CSS and off you go.
Any other limitations / gotchas that I should be aware of?
I remember the validation being very limiting, especially if validation of a field is dependent on another field.

ClickFunnels integration with rails2 app

Is there a way to create a page in ClickFunnels(https://www.clickfunnels.com/) website and when I submit that page, I need to store the form details in my rails app(into a particular table). Which means I want to display my database in the clickfunnels integrations list. I googled hours but couldn't get much information on this.
can anyone suggest me if you have done this. A reference link also much appreciated.
We couldn't find any way to do this inside clickfunnels itself, if there is a easy way to add custom systems to their integrations I too look forward to seeing those answers. Until then, here's what we did: We just put our custom form on their page and used ajax to send it back out the end point in our system it needed to hand that data too.
Then, since we also needed to submit the same info to click funnels, we build a fake CF form(I think we actually put one on the page, but used CSS to hide it, then filled it out dynamically from our custom form), and call submit on that form, sending the user through the normal click funnels submission process and sending them to the next page in the funnel.

Cakephp 2.x and Jquery Ajax - Cake doesn't think request is ajax

I am working on a little cakePHP application and am trying to AJAX it up a bit with JQuery to make it work a bit nicer for users.
I have just followed this tutorial: Cakephp Jquery AJAX Tutorial but for some reason it isn't working.
One great bit about the tutorial is that functionality falls back to normal CakePHP if the request isn't an AJAX request so my app still works but it doesn't work the AJAX way...
It looks like in my Controller, the request doesn't pass the test:
if($this->request->is('ajax'))
and so continues onto the normal $this->redirect(...) of the non-AJAX way.
Could it be something to do with the if statement for 'ajax'? In the tutorial the author is using a version of cakePHP before 2.0 and so uses $this->RequestHandler->isAjax() but this was deprecated as of cakePHP 2.0.
Thanks for your time.
JsHelper::link might do what you want.
As I think you have discovered, it's nothing to do with Cake. It's because in the tutorial he tells you to make a link, then you are clicking the link to run the action. This causes the AJAX request to fire, but also the actual link gets followed.
You need preventDefault() in your jQuery click event, to stop the browser from following the link in the normal way. This will not affect the link if the user doesn't have JavaScript... because they won't have the click event occur in the first place :)

Alert box a good practice or not

I have a web form with more than 10 fields that are submitted to the database. So before submitting the values I am doing JavaScript validation.
Currently I am using JavaScript validation and shows an alert box if an error occurs in data entry.
Is it a good practice to show alert box when JavaScript validation fails or should I use asp.net validation controls to display the error messages?
I'd avoid using an alert box. It's annoying, requires an extra click, and since it's modal - stops the entire browser.Instead, highlight the erroneous fields/values, and print a message at the top, explaining that the highlighted fields need to be corrected before the user can continue.You can use Asp.Net validation, or jQuery form validation - both work equally well.
ASP.NET Validation controls are more recommended, because the alert can be intrusive. They can be set to give messages without posting back, which is ideal.
Just make sure you make it obvious when the form has failed.
from the usability perspective it is much better to use .net validation. Depending on your alert box implementation you may bombard user with many alerts which is very bad.
Also don't rely on client side validation only. Be sure to validate on the server side as well. And this is where .net validation might be handy again.
A good practice is what when your code supports fall back method. For example, if Javascript is disabled then the user should still be able to view the error messages, if any.
More over, they dont look as good as you could style your own divs and display them after some server side validation .. and then use javascript to hide/fade out this error message container div.
I think its a personal/design preference.
Sometimes its just more obvious when there is a javascript alert indicating something needs to be done. Sometimes a small red asterisk gets lost on the page.
In my own opinion, alert boxes are just too annoying to see on websites these days since they're all you see on Windows... But, if you prefer a better looking site, use something else. If you want to make sure the message gets across - then use an alert.

Resources