2012-07-29, 08:27 AM
I need to either add an onsubmit function, or figure out how to add something to the validator for when the form is submitted. Does anyone know how I can do this?
Basically, when the form is submitted, I need to execute a javascript function which will validate an asirra form with the server, placing a hidden input value in the form containing the ticket which I can use to validate it from the server afterwards. Is there any way I can do this?
Thank you.
P.S.- This is all being done from a plugin I'm working on.
Edit: Ok, managed to get it to check the assira function in javascript, but when I do that, I need to manually submit the form using js when Asirra sends a confirmation to the callback function. The problem with this is that when I submit the form using $('registration_form').submit(), it goes back to the registration agreement page. I debugged it and the $mybb->input variables are set (the ones from the form), so it's not erasing them, but it's still showing the agreement form. Anyone know why this is?
Edit 2: Fixed it. Needed to insert a hidden value for agreement and set it to true. I'm assuming mybb sends the post for agreement somewhere that wasn't working when I submitted it with js? Still doesn't make much sense to me, but I got it working regardless.
Basically, when the form is submitted, I need to execute a javascript function which will validate an asirra form with the server, placing a hidden input value in the form containing the ticket which I can use to validate it from the server afterwards. Is there any way I can do this?
Thank you.
P.S.- This is all being done from a plugin I'm working on.
Edit: Ok, managed to get it to check the assira function in javascript, but when I do that, I need to manually submit the form using js when Asirra sends a confirmation to the callback function. The problem with this is that when I submit the form using $('registration_form').submit(), it goes back to the registration agreement page. I debugged it and the $mybb->input variables are set (the ones from the form), so it's not erasing them, but it's still showing the agreement form. Anyone know why this is?
Edit 2: Fixed it. Needed to insert a hidden value for agreement and set it to true. I'm assuming mybb sends the post for agreement somewhere that wasn't working when I submitted it with js? Still doesn't make much sense to me, but I got it working regardless.