vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.6 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=194)
-   -   New Posting Features - Form Hack (https://vborg.vbsupport.ru/showthread.php?t=126676)

viper357 09-19-2008 11:23 AM

Can somebody please help with why I am getting this error when I submit the form.

Fatal error:

* Please complete both the subject and message fields.

Unable to proceed with save while $errors array is not empty in class vB_DataManager_PM in /includes/class_dm.php on line 763

Bilderback 09-24-2008 11:47 PM

You have to be very careful with this form as you will get data manager errors if you have multiple forms using the same variables.
My advice is to become very familiar with the form before using it.
This way , you can create your own variable.
Example:
Instead of
$question1="What is your name?";
you can write your own variable...
$form_one_question1="What is your name?";
or
$form_one_name="What is your name?";
Definitely not for the impatient but a great product.

There are a few bugs like if you have a question:
Do you have a name? If yes, please state your name.
Someone can still choose no and state their name so it shows as:
No
My Name

I have found a quick fix conditional to add to your formanswers template that works fairly well for me.
Code:

<if condition="$radioanswer1other!=''">yes<else />$radioanswer1</if>
What this does is if the name area is not empty, it changes the No to Yes.
So your actual code for the question assuming it is $radioquestion1 is as follows:
Code:

$radioquestion1
<if condition="$radioanswer1other!=''">yes<else />$radioanswer1</if>
$radioanswer1other

I have to say I am having fun with this hack.
Another thing I noticed is that HTML is not parsing in the formanswers template
and any BBCode produces errors.
Is there any way around this?
I would like to add some styling to the form when it is posted to a thread like using Bold and Underline and possibly a hyperlink to various answers.
Thanks

swisscotton 09-28-2008 01:09 PM

I have installed this hack but for some reason the answers to the normal questions ($question) are not showing up on priview or when its submitted. :confused:

My PHP isn't very good at all so I was hoping someone for have a quick look for me?
http://www.fileden.com/files/2007/3/...ot_working.txt

Emma

Bilderback 09-28-2008 03:41 PM

Part 1 and Part 2 have to be the same for your answer variables.
My suggestion is to first write down all questions and answers, then add to form.
Example:
$question1 = "What is the Rabbits Name?";
$explain1 = "Please enter your real name here.";

In question1, you would only need to clean the answer1
(your own questions and explains dont need to be run through the vb input.)
Code:

// Part 1
$vbulletin->input->clean_array_gpc('p', array(
'$answer1' => TYPE_STR,
));
// Part 2
$answer1 = $vbulletin->GPC['normalanswer1'];

You also need to be sure that all the same $variables are distributed properly to the templates.
form template
Code:

<tr>
<td class="alt2" valign="middle">
<b>$question1</b>:<br />
$explain1</td>
<td class="alt2" valign="middle" colspan="2">
<input type="text" size="30" value="$answer1" name="answer1" /></td>
</tr>

answer template
Code:

$question1
$answer1


Nuguru 09-28-2008 03:54 PM

Hello,

Great mod, but has this mod been updated to work with vb 3.7.3 or above?

Thx

swisscotton 09-28-2008 07:03 PM

Quote:

Originally Posted by Bilderback (Post 1632330)
Part 1 and Part 2 have to be the same for your answer variables.
My suggestion is to first write down all questions and answers, then add to form.
Example:
$question1 = "What is the Rabbits Name?";
$explain1 = "Please enter your real name here.";

In question1, you would only need to clean the answer1
(your own questions and explains dont need to be run through the vb input.)
Code:

// Part 1
$vbulletin->input->clean_array_gpc('p', array(
'$answer1' => TYPE_STR,
));
// Part 2
$answer1 = $vbulletin->GPC['normalanswer1'];

You also need to be sure that all the same $variables are distributed properly to the templates.
form template
Code:

<tr>
<td class="alt2" valign="middle">
<b>$question1</b>:<br />
$explain1</td>
<td class="alt2" valign="middle" colspan="2">
<input type="text" size="30" value="$answer1" name="answer1" /></td>
</tr>

answer template
Code:

$question1
$answer1


Thanks for that. But I really can't do it. I don't know PHP at all. I have tried tweaking it but nothing is appearing. I have tried going back to the default form and inputting it again but I am still not getting the answers appearing :(

swisscotton 09-28-2008 07:39 PM

Not only dosn't it display the ansewrs its still only showing the first three questions on preview (I have added them into the html).

http://www.fileden.com/files/2007/3/...t_working2.txt

I know is something I am doing wrong because I am a designer and know nothing what so ever about this kind of thing. It is a very basic form I am trying to put together.

Bilderback 09-29-2008 12:37 AM

Like I stated in a previous post, its more coder-oriented and without much documentation.
The idea is to first develop your variables list
(Note:You only have to use the vbulletin cleaner on a variable which will allow user input.)
So if my first question was:
$question1="What is your name?";
$explain1="Please enter your name here";
Neither of those have to be passed through vb input cleaner.
-only the $answer1 since it takes user input.
I clean everything... even radio boxes that you think would only be a Yes or No,
just in case a hacker tries to manipulate any input variables.

You cannot use the same variable twice or it is overwritten resulting in possible errors.
So you cannot do:
$question1="What is your name?";
$question1="How old are you?";
This is basic variable handling as you are redeclaring the var resulting in it being overwritten.
If you are trying to use the default form as reference as you make a custom form,
the script is being executed ,corrupting default variables if you are not assigning your own.
So I recommend disabling the default form if you make custom.

After all your variables are assigned properly within the plugin, you then edit the form template
to your liking which takes basic vbulletin template handling.

And also do the same with the output template (answer template) which will be the
template that posts to your thread or post.
Both templates have to use the same variables as you stated in the form plugin.

The easiest way I have found is to write down my questions and answers on paper
or in editor so that I have a basic set.
Then, I go through and create the variables, place them in the order I want in the templates,
and everything should work.

It takes a bit of a learning curve but well worth it.
Maybe someday, the Form Hack will be enhanced to set up the form from adminCP area.

swisscotton 09-30-2008 11:54 AM

I dont know what you mean by "cleaning" I am new to VB and I haven't a clue about PHP but this forum is an importent part of my forum.

This is how it is set up so far:

Quote:

// Part 1
$vbulletin->input->clean_array_gpc('p', array(
'$answer1' => TYPE_STR,
'$vbtextexplain' => TYPE_STR,
));

// Part 2
$answer1 = $vbulletin->GPC['normalanswer1'];
$longanswer1 = $vbulletin->GPC['longanswer1'];

Quote:

//QUESTION 1 (do not use quotation marks or you will get a parse error, besides the quotes around the whole text)
$question1 = "What is the Rabbits Name?";
$explain1 = "Please enter your real name here.";

//QUESTION 2 (do not use quotation marks or you will get a parse error, besides the quotes around the whole text)
$question2 = "What breed is the Rabbit?";
$explain2 = "Please enter your real name here.";

//QUESTION 3 (do not use quotation marks or you will get a parse error, besides the quotes around the whole text)
$question3 = "Is the rabbit spayed or neutered?";
$explain3 = "Please enter your real name here.";

//QUESTION 4 (do not use quotation marks or you will get a parse error, besides the quotes around the whole text)
$question4 = "How old is the Rabbit?";
$explain4 = "Please enter your real name here.";

//QUESTION 5 (do not use quotation marks or you will get a parse error, besides the quotes around the whole text)
$question5 = "What colour is the rabbit?";
$explain5 = "Please enter your real name here.";

//QUESTION 6 (do not use quotation marks or you will get a parse error, besides the quotes around the whole text)
$question6 = "Bonded or Single Rabbit?";
$explain6 = "Please enter your real name here.";

$vbtextquestion = "Information & Photos";
$vbtextexplain = "Please write more information about the rabbit, such as its background, how you managed to save him or her, the rabbit’s personality, and what the ideal home would be for this rabbit. Also post photos of the rabbit.";
The '$vbtextexplain' => TYPE_STR, (text area) works find its just the normal answers that don't.

I a run an animal welfare forum and this form will be used for animals needing homes and to let me know details about the animal so I can put those details onto the site.

Bilderback 09-30-2008 01:20 PM

Part 1 and Part 2 need to have the same variables which rely on any questions asked.

Code:

// Part 1
$vbulletin->input->clean_array_gpc('p', array(
'$answer1' => TYPE_STR,
'$answer2' => TYPE_STR,
'$answer3' => TYPE_STR,
'$answer4' => TYPE_STR,
'$answer5' => TYPE_STR,
'$answer6' => TYPE_STR,
));

// Part 2
$answer1 = $vbulletin->GPC['answer1'];
$answer2 = $vbulletin->GPC['answer2'];
$answer3 = $vbulletin->GPC['answer3'];
$answer4 = $vbulletin->GPC['answer4'];
$answer5 = $vbulletin->GPC['answer5'];
$answer6 = $vbulletin->GPC['answer6'];



All times are GMT. The time now is 12:31 AM.

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.02510 seconds
  • Memory Usage 1,768KB
  • 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
  • (9)bbcode_code_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (4)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete