I have a form that I created using a plugin which upon clicking the Submit button, it's redirecting to a URL that I selected in the form's settings. But the problem is that any other form that I create, it gets directed to the same URL that I selected on my original form. I need to trace the Submit action to see where its going and what functions are being called. Any thoughts and suggestions will greatly be appreciated.

| improve this question | | | | |
  • What plugin did you use? – coopersita Sep 7 '15 at 22:41
  • ARForms. I had this form customized by a developer and he must have done something to this plugin so that now all forms that I create get to be redirected to the same URL. – Dave_O Sep 7 '15 at 22:56
  • You could try a different plugin (in addition, or instead), or try to get a copy of the original plugin to undo your developer's changes. – coopersita Sep 7 '15 at 23:37
  • do you have any suggestions to trace a Submit button though? – Dave_O Sep 7 '15 at 23:57
  • 1
    You could add a hidden field to the form. On the receiving end, check the field to redirect. Not very elegant though. I'm not familiar with that plugin, so I don't know how they do the redirection. – coopersita Sep 8 '15 at 0:50

Still using jQuery, you can do this:

$('form').submit(function() {
    // Use this to echo in JS console.
    console.log( $(this).attr('action') );
    // Use this to display a popup.
    alert( $(this).attr('action') );

This will track every form being submitted.

Place this between <script> tags or in a JS file. Like @dev said, this for debug purpose, don't keep this in your code.

You may have to wait for Document to be ready, then you'd use :

// Needs jQuery too.
$(function() {
    // Copy code here.
| improve this answer | | | | |

yes you can use jquery, like

| improve this answer | | | | |
  • Where do I need to place this? Thanks. – Dave_O Sep 8 '15 at 5:36
  • 1
    this is for debugging, means even you can use that in browser console, instead of form use the form id and you will get the form action and after that you can modify the form action like $('#form1').attr('action','your action'); – dev Sep 8 '15 at 5:41
  • 1
    place this code in <script> $(document).ready(function(){ $('form').submit(function() { // Use this to echo in JS console. console.log( $(this).attr('action') ); // Use this to display a popup. alert( $(this).attr('action') ); }); }); </script> in head section recommended – WisdmLabs Sep 8 '15 at 10:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.