vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   How do I handle form input from a widget? (https://vborg.vbsupport.ru/showthread.php?t=237243)

fdifranco 03-02-2010 01:31 AM

How do I handle form input from a widget?
 
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:

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


All times are GMT. The time now is 04:45 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00895 seconds
  • Memory Usage 1,709KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (2)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete