vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.8 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=235)
-   -   New Posting Features - Easy Forms - Create a form or multiple forms without php or html knowledge (https://vborg.vbsupport.ru/showthread.php?t=201097)

arkkhoax 07-08-2009 06:06 AM

Hey! I'm having a small problem with a custom question that defaults to the users age. I'm having problems validating the input when the form is submitted.

For my custom question I have this code (this part works):
PHP Code:

list($month,$day,$year) = explode("-",$vbulletin->userinfo['birthday']);
$year_diff  date("Y") - $year;
$month_diff date("m") - $month;
$day_diff   date("d") - $day;
if (
$month_diff 0$year_diff--;
elseif ((
$month_diff==0) && ($day_diff 0)) $year_diff--;
$realage $year_diff;

$answer '<input type="text" id="q_' $formbit[id] . '" name="' $formbit[id] . '" value="' $realage '" />'

I want the user to be able to change the age I default the question to. I also want to make sure that input is a valid number so I wrote a few lines to do that.

In the "Before Submit" area I have this: (my custom question has an id of 15)
PHP Code:

$q[15] = (int)$q[15]; //make sure we only have a number
if($q[15] < 18$q[15] = 18;
if(
$q[15] > 120$q[15] = 120

Here is where the problem comes in! When the forum is submitted or previewed the text in the age field shows up but my "Before Submit" code does not take effect. So if I were to type "cool" in the age field it shows "cool" in the preview instead of showing 18 as I would expect (type casting 'cool' to an int should return zero, zero is less than 18 so it should be set to 18).

Any help would be great! I'm sure it's just something little I am missing. I know what I am doing may seem a little silly out of context but I want it to work this way. :)

bananalive 07-10-2009 03:30 PM

Quote:

Originally Posted by chet (Post 1844645)
Can this been used as a forum application form, I run a closed forum but would like users to be able to apply to join.

Thanks

Non-registered users can submit forms if you desire. But using it to create new users is not a function

bananalive 07-10-2009 03:32 PM

Quote:

Originally Posted by WickedWeb (Post 1844970)
Im posting this with the disclaimer of many others. I have tried searching this thread but its huge and I've had no luck at the moment so my apology if its been answered.

If it helps any I've Installed* Rated 5 Stars and Nominated as its well deserved for all 3 in my opinion. I can do anything with this.

My problem is this. In the vb form options you can set it for the button to show up in your navbar which I have done. I use a custom template so what I need to do is assign the button a defined height and width along with a class for it to blend nicely with my layout. I have looked in the header and other locations that I can think of looking for anyway to add my desired values but I never see any reference of the button along side the other navbar buttons. Where do I need to be to achieve this?

My sincere thanks

Atm, you have to edit a plugin.

But in v3.7 (available very soon) you can just customise the template form_navbar

bananalive 07-10-2009 03:33 PM

Quote:

Originally Posted by arkkhoax (Post 1844981)
Hey! I'm having a small problem with a custom question that defaults to the users age. I'm having problems validating the input when the form is submitted.

For my custom question I have this code (this part works):
PHP Code:

list($month,$day,$year) = explode("-",$vbulletin->userinfo['birthday']);
$year_diff  date("Y") - $year;
$month_diff date("m") - $month;
$day_diff   date("d") - $day;
if (
$month_diff 0$year_diff--;
elseif ((
$month_diff==0) && ($day_diff 0)) $year_diff--;
$realage $year_diff;

$answer '<input type="text" id="q_' $formbit[id] . '" name="' $formbit[id] . '" value="' $realage '" />'

I want the user to be able to change the age I default the question to. I also want to make sure that input is a valid number so I wrote a few lines to do that.

In the "Before Submit" area I have this: (my custom question has an id of 15)
PHP Code:

$q[15] = (int)$q[15]; //make sure we only have a number
if($q[15] < 18$q[15] = 18;
if(
$q[15] > 120$q[15] = 120

Here is where the problem comes in! When the forum is submitted or previewed the text in the age field shows up but my "Before Submit" code does not take effect. So if I were to type "cool" in the age field it shows "cool" in the preview instead of showing 18 as I would expect (type casting 'cool' to an int should return zero, zero is less than 18 so it should be set to 18).

Any help would be great! I'm sure it's just something little I am missing. I know what I am doing may seem a little silly out of context but I want it to work this way. :)

In Before Submit plugin remove any comments or use instead:
PHP Code:

/* start comment here

end comment */ 

eg.
PHP Code:

$q[15] = (int)$q[15]; /*make sure we only have a number*/
if($q[15] < 18$q[15] = 18;
if(
$q[15] > 120$q[15] = 120


Quantnet 07-10-2009 10:17 PM

Quote:

Originally Posted by bananalive (Post 1844553)
What part did you want to use ajax?

Could we have some fields on the top of the form result table where we can filter the result table by?

If we have like 100 people submit the forms, may be the result can be filtered by one of the choice in a form question.

maybe Ajax can be used here.

Quote:

Originally Posted by bananalive (Post 1844554)
Currently it is not possible for those who cannot edit forms to view form results table. This is something i am working on for v3.7.

Very much looking forward to it.

Quote:

Originally Posted by bananalive (Post 1844549)
1. i might move that into phrase for next version.

2. it's hard coded atm.

3. you'll be missing two javascript files, which are needed for javascript sort table

all are welcome news.

Saviour 07-12-2009 11:30 AM

Just noticed there's an update for this mod...v3.7beta. Are there any release notes as to what this update includes? Also, are there any upgrade instructions?

Thanks, bananalive...for another great mod!

bananalive 07-12-2009 11:41 AM

Quote:

Originally Posted by Saviour (Post 1847403)
Just noticed there's an update for this mod...v3.7beta. Are there any release notes as to what this update includes? Also, are there any upgrade instructions?

Thanks, bananalive...for another great mod!

Version history contains latest additions:

Quote:

v3.7
- Added template hook for form hidden fields
- Added compulsory question * as phrase
- Form Results Table and Form Results Poll moved to templates
- Form Navbar link moved to tempalte
- JavaScript sort results table
- added permissions for Usergroups to view form results (those who can edit forms can also view form results)
Installation Instructions:
  1. Import product file in admincp
  2. upload easyforms.js and easyforms.css to clientscript/

Saviour 07-12-2009 12:02 PM

Thanks, bananalive...

One thing I've noticed, though...

This is displayed on the forms..."Please Note: Questions proceeded by an asterisk (*) are compulsory." Actually, the asterik (*) does not proceed the question, but appears after the question. Also...anyway to change this and make the asterisk (*) red in color?

Quantnet 07-12-2009 01:46 PM

Updated to 3.7 beta and upload the js files. To sort column, just click on the column header name and an arrow down will appear next to the header name.

This is not too obvious to people since it's hard to tell you can sort. Maybe we can add a filter section on top to display only the columns we want in case we have 20+ columns?

joe1989 07-13-2009 12:27 AM

Quote:

Originally Posted by Saviour
Actually, the asterik (*) does not proceed the question, but appears after the question.

"Proceed" means "to come after." Precede means before. The coder is correct; your vocabulary is backwards!

Saviour 07-13-2009 12:43 AM

LOL...Must've been a dyslexic moment.;)

Cyricx 07-13-2009 08:19 PM

I've been having the same problem as others in that when I create a new form and then try to save changes to it, I get redirected to my first forum without the changes being saved.

I was running an old version of VBSeO but even tried disabling it and uninstalling it and still have the issue occuring.

Quantnet 07-13-2009 11:40 PM

bananalive,
Can you give instruction for people who want to edit the form result table template to add/arrange the column, etc

Also, is the feature for people to delete their own form enabled in this 3.7beta version yet?

Thanks

Dagothar 07-14-2009 01:54 AM

Wow. Great work!
I haven't read thru all 81 pages of comments, yet, but perhaps you'd forgive me....
Where's your Donate link? (ADD one!) [You deserve it!]

bananalive 07-14-2009 12:55 PM

Quote:

Originally Posted by Saviour (Post 1847424)
Thanks, bananalive...

One thing I've noticed, though...

This is displayed on the forms..."Please Note: Questions proceeded by an asterisk (*) are compulsory." Actually, the asterik (*) does not proceed the question, but appears after the question. Also...anyway to change this and make the asterisk (*) red in color?

Edit Phrase: compulsory_questions_explained

bananalive 07-14-2009 01:01 PM

Quote:

Originally Posted by Quantnet.org (Post 1847457)
Updated to 3.7 beta and upload the js files. To sort column, just click on the column header name and an arrow down will appear next to the header name.

This is not too obvious to people since it's hard to tell you can sort. Maybe we can add a filter section on top to display only the columns we want in case we have 20+ columns?

Possible collapse columns would be best, but I'm not sure atm. I'll have a ponder...

bananalive 07-14-2009 01:01 PM

Quote:

Originally Posted by Cyricx (Post 1848291)
I've been having the same problem as others in that when I create a new form and then try to save changes to it, I get redirected to my first forum without the changes being saved.

I was running an old version of VBSeO but even tried disabling it and uninstalling it and still have the issue occuring.

Try v3.7

bananalive 07-14-2009 01:23 PM

Quote:

Originally Posted by Quantnet.org (Post 1848343)
bananalive,
Can you give instruction for people who want to edit the form result table template to add/arrange the column, etc

Also, is the feature for people to delete their own form enabled in this 3.7beta version yet?

Thanks

The columns and their order is based on the current form questions.

No

bananalive 07-14-2009 01:25 PM

Quote:

Originally Posted by Dagothar (Post 1848377)
Wow. Great work!
I haven't read thru all 81 pages of comments, yet, but perhaps you'd forgive me....
Where's your Donate link? (ADD one!) [You deserve it!]

Thanks,

You can click the Support Developer in the right hand side of first post of every page. Beneath Mod Information and The Developer.

Quantnet 07-14-2009 01:28 PM

Ok, thanks
I like to move the Time column right now to the end right of the form result table and edit them as Last Updated, and also format to show the date only, not the time.

Quantnet 07-15-2009 02:56 AM

Quote:

Originally Posted by bananalive (Post 1844553)
it is much easier to implement than updating it.

This refers to my question about the ability for users to update their form answers.

I'm just curious: technically speaking, since the result are stored in database as a block of text, isn't it possible for you to do a sql update query to replace that row with the new row?

How about we change the way we store data in database as column, would it be easier for you?

I'm just throwing it up out there and hope for a chance you will ponder the possibility.

Thanks

Mimirswell 07-15-2009 02:59 AM

When a form is submitted, I would like an automated specific prefix to be added to the thread. How would I go about doing this?

bananalive 07-15-2009 07:03 AM

Quote:

Originally Posted by Mimirswell (Post 1848957)
When a form is submitted, I would like an automated specific prefix to be added to the thread. How would I go about doing this?

You can specify a prefix for a thread when editing a form.

Cyricx 07-15-2009 12:11 PM

Quote:

Originally Posted by bananalive (Post 1848577)
Try v3.7

I uninstalled the forms modification.

Installed 3.7

No dice, still redirects to first forum

Uninstalled 3.7

Installed 3.6

No dice, still redirects to first forum.

If you'd like admin access to view it, I can give you a test login that'll allow you to edit the forms on my board.

Elenna 07-15-2009 05:30 PM

It looks like the custom output is working differently for drop-down choices.

Here is an example:

Question: What is your favorite color? (single-selection drop-down)

When not using a custom output format, it displays fine, like this:

What is your favorite color?
Blue

Using a custom output it looks to display the number of the choice, rather than the choice itself, like this:

This is the custom output:
{username} tells us that their favorite color is $q[30].

(username) tells us that their favorite color is 2.

It seems to work well for the normal text fields.

Noctavia 07-16-2009 10:34 PM

Nevermind, all fixed.

Andyrew 07-17-2009 10:37 AM

How do i remove from a post that appears as a blank space when a user does not fill in an optional question.

Strike-Force.ne 07-17-2009 02:31 PM

Looks very interesting, and good for an idea I have.

bananalive 07-17-2009 03:52 PM

Quote:

Originally Posted by Cyricx (Post 1849174)
I uninstalled the forms modification.

Installed 3.7

No dice, still redirects to first forum

Uninstalled 3.7

Installed 3.6

No dice, still redirects to first forum.

If you'd like admin access to view it, I can give you a test login that'll allow you to edit the forms on my board.

If you pm me details of test account i'll have a look.

bananalive 07-17-2009 03:53 PM

Quote:

Originally Posted by Elenna (Post 1849372)
It looks like the custom output is working differently for drop-down choices.

Here is an example:

Question: What is your favorite color? (single-selection drop-down)

When not using a custom output format, it displays fine, like this:

What is your favorite color?
Blue


Using a custom output it looks to display the number of the choice, rather than the choice itself, like this:

This is the custom output:
{username} tells us that their favorite color is $q[30].

(username) tells us that their favorite color is 2.


It seems to work well for the normal text fields.

Use custom output:

{username} tells us that their favorite color is $qo[30].

bananalive 07-17-2009 03:55 PM

Quote:

Originally Posted by Andyrew (Post 1850464)
How do i remove [B][SIZE=3][/SIZE][/B] from a post that appears as a blank space when a user does not fill in an optional question.

Form Hook: Before Submit:

$formoutput = str_replace("[B][SIZE=3][/SIZE][/B]", "", $formoutput);

Andyrew 07-17-2009 05:48 PM

Thanks. :up:

Elenna 07-17-2009 07:27 PM

Thanks again, bananalive! :)

Andyrew 07-19-2009 11:19 AM

Quote:

Originally Posted by bananalive (Post 1850621)
Form Hook: Before Submit:

$formoutput = str_replace("[B][SIZE=3][/SIZE][/B]", "", $formoutput);

Someone has just filled in the form and it still left a space, the above code was not removed from the post. :confused:

BostWick-x 07-19-2009 09:47 PM

I'm sorry if this has already been answered (I did search through the thread), but how would I go about creating a hook that checked to see if a users post count was above 10? I have no PHP knowledge. (At best, all I can do is look at a chunk of code and get the general understanding of what it does)

The reason I ask this is because my forum is dedicated to an online game, and I want to be able to give people the option to create a forum for their clan. I want there to be a minimum post requirement for them to be able to do this, because in the past I have had to check manually and it's sort of a pain for me to do.

Thanks!

Dagothar 07-19-2009 11:58 PM

Quote:

Originally Posted by bananalive (Post 1848591)
Thanks,

You can click the Support Developer in the right hand side of first post of every page. Beneath Mod Information and The Developer.

Ack--thought on some pages I saw a PayPal button, and was only looking for that. :embarassed:
Done. Thanks again!

bananalive 07-20-2009 11:32 AM

Quote:

Originally Posted by Andyrew (Post 1851613)
Someone has just filled in the form and it still left a space, the above code was not removed from the post. :confused:

If you want to remove the question as well look at the bbcode code and text you wish removed and add it exactly into hook where X is:

Form Hook: Before Submit:

$formoutput = str_replace("X", "", $formoutput);

bananalive 07-20-2009 11:34 AM

Quote:

Originally Posted by BostWick-x (Post 1851861)
I'm sorry if this has already been answered (I did search through the thread), but how would I go about creating a hook that checked to see if a users post count was above 10? I have no PHP knowledge. (At best, all I can do is look at a chunk of code and get the general understanding of what it does)

The reason I ask this is because my forum is dedicated to an online game, and I want to be able to give people the option to create a forum for their clan. I want there to be a minimum post requirement for them to be able to do this, because in the past I have had to check manually and it's sort of a pain for me to do.

Thanks!

Add the following php code to Form Hook: Form Start:

PHP Code:

if($vbulletin->userinfo['posts'] < 10)
{
$errormessage "You need 10 posts to use this form.";
eval(
'print_output("' fetch_template('STANDARD_ERROR') . '");');



Andyrew 07-20-2009 03:55 PM

1 Attachment(s)
Quote:

Originally Posted by bananalive (Post 1852123)
If you want to remove the question as well look at the bbcode code and text you wish removed and add it exactly into hook where X is:

Form Hook: Before Submit:

$formoutput = str_replace("X", "", $formoutput);

Still not removing anything. :( What i am using is a for sale listing form, and one question is does your item come with a scope. yes/no = radio checkbox.
Then if the answer is no the next question they are told to ignore, but if yes the next question they fill in the type of scope.
So if they choose "no" and don't fill in the type of scope, this is then submitted with a space/gap in the for sale thread, if i click on edit thread i have to remove [b][size=3][/size][/b] from the post to remove the space/gap between the item for sale listing. Maybe i have to tell the form somehow to ignore the next question if the answer is "no"
See pic for example of gap between rows.

BostWick-x 07-20-2009 06:13 PM

Quote:

Originally Posted by bananalive (Post 1852125)
Add the following php code to Form Hook: Form Start:

PHP Code:

if($vbulletin->userinfo['posts'] < 10)
{
$errormessage "You need 10 posts to use this form.";
eval(
'print_output("' fetch_template('STANDARD_ERROR') . '");');



Thank you very much, that did the trick. :)


All times are GMT. The time now is 09:14 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.02831 seconds
  • Memory Usage 1,892KB
  • 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
  • (8)bbcode_php_printable
  • (26)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (2)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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