PDA

View Full Version : How do I handle form input from a widget?


fdifranco
03-02-2010, 01:31 AM
Hello there,

Let's say I want to write a widget that contains a trivia question. I don't have a problem creating the form in the widget with PHP.

I have a multiple choice question and the user selects "A" (the first option) and submits the form. I understand that in my form action I need to specify a handler. What I've done to test my widget is to handle the form in another PHP page, that's pretty straight-forward.

The problem is that the action is being handled by a page that isn't a vBulletin page so the output from my PHP page is plain. No nice vBulletin-looking page.

How should I handle the form input? Is there a vBulletin page that I need to use in my action instead of my vanilla PHP page?

Any help is appreciated. Thanks in advance.

fdifranco
03-05-2010, 02:51 AM
I found the answer here (https://vborg.vbsupport.ru/showthread.php?t=228112):

Why that post isn't a sticky I'll never know. Anyone who wants to do any sort of customization is going to need that post in a big way.

The long and the short of it is that you create a php file that will process the form and assign to a variable whatever html you have generated.

Once you register the variable you will be able to access it from a custom template which you will need to write as well.

Anyways, follow the post and you'll be alright. I might make a YouTube video on how to do it.

-fab