Plugin Form Help
#5
No, in my original form in SMF it just passed an action to the index.php file and passed all the parameters to it. In MyBB things seem to be done a little differently. From the examples I have looked at, the forms use an onclick handler which calls a javascript function when then makes an AJAX request to another function. This is the bit I am struggling with. For some reason my javascript function never gets called. I wondered if someone could help with this as it's my first attempt at using Javascript and AJAX. Even after trying to follow the other plugins as an example, I cannot get it to work.
The first bit I am unsure of is how I pass the values of the form to the javascript function.
My mistake. I had put an onclick handler but hasn't put a quote on the end. Now I have something like this

onclick="(javascript:myfunction('3', this)"

The '3' is the topic id and 'this' is how you pass the form as far as I can tell.

My javascript function looks like:

function myfunction(tid, f)

However, when I click the submit button, I get a page saying I do not have permission to access this page. What am I doing wrong?
I've installed firebug which is a great help. I can now see that my function is being called which is progress. The error I am getting is:

f.status is undefined
$status = f.status.value

f is the second parameter which is passed in as 'this' from the form. 'status' is the listbox. I thought I could then just get the value from the above command. (i.e. $status = f.status.value). Obviously not.

What am I doing wrong?
Never mind. I've solved the problems and am now making good progress. Thanks for help though.
Reply


Messages In This Thread
Plugin Form Help - by Zoolman - 2011-03-07, 09:50 PM
RE: Plugin Form Help - by Euan T - 2011-03-07, 10:35 PM
RE: Plugin Form Help - by Zoolman - 2011-03-08, 09:20 AM
RE: Plugin Form Help - by Euan T - 2011-03-08, 09:27 AM
RE: Plugin Form Help - by Zoolman - 2011-03-08, 09:57 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)