Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+26 votes
16.4k views
in Plugins by
edited by

This plugin add extra fields to ask / edit form and question page. Although Q2A can add only one textbox, this plugin can add textbox / checkbox / selectionbox / radiobutton / textarea / file without any restriction. Refer to readme in download-file for description.

Views

  1. Screen shot 1: ask form
  2. Screen shot 2: page view (no design by CSS)
  3. Screen shot 3: edit form

Compatibility

Q2A V1.6, V1.7 [2014/12/30 Updated]

Update history

  • [V1.7] 2015/02/04 Add file extension check feature in case of file type field.
  • [V1.6.4] 2014/09/19  Fixed bug (If files exist on upper content, popup don't work)
  • [V1.6.3] 2014/03/16  Fixed bug (Error on none description question post)
  • [V1.6.2] 2014/03/13  Fixed bug (Post data of none moderated user is not stored on moderation mode)
  • [V1.6.1] 2014/01/09  Fixed bug when question is hided.
  • [V1.6] 2013/12/13  Add lightbox effect with responsive design.
  • [V1.5] 2013/12/05  Add textarea and file type. And, Fixed a lot of bugs.
  • [V1.4] Add required option.

Download

Have hun !!

Q2A version: 1.6, 1.7
by
congratulations =)
by
Thank you Kai.
by
Wonderful plugin specially who dont now how to add extra fields to question...congtrats....
by
Thank you jatin.
by
I released V1.1.  Add option [Hide on question page if blank]
http://www.question2answer.org/qa/23346/new-plugin-extra-question-field?show=23365#a23365
Thanks VdoubleE.
by
I released V1.2.
  Add option [Attributes]
  Sanitize input string for sequrity.
by
I released V1.3.
  Add option [Explanation on question form]
  Add option [Position on question form]
  Add option [Position on question page]
by
I released V1.3.1.
  Fix small bug [Attributes error message in plugin setting page]
by
I released V1.3.2.
  Fix bug [Ask form error when unlogin]
by
Hey sama55 nice upgrade! I just spotted 1 small thing. There is no spacing on Label on question form information. For example  

Information:bla bla bla (how it looks)

Information: bla bla bla (how it should look)
by
@VdoubleE nice point. I also considered same thing. You can change appearance by CSS of your theme. Moreover, appearance is also changeable for every field.
For example:
.qa-q-view-extra-content {  /* This is Q2A core standard class. */
  margin-left:0.5em;  /* ! */
}
.q-view-extra-content1 {  /* This is plugin added class. "1", "2", "3"... */
  font-weight:normal;
}
If fields structure are changed, it is necessary to change CSS. Although this point is no good... Sorry.  ^_^;
by
Hi, does this plug-in work for 1.6 as well? I don't see this in Plugins list from Admin.
by
edited by
Latest version of this plugin is 1.3.3. I confirmed compatibility with 1.6. But I didn't confirm the compatibility with other plugin. I don't understand the cause that plugin list does not have. This plugin is working definitely in my site(Q2A1.6). There is the compatibility information of my parts below.
http://www.question2answer.org/qa/user/sama55
by
Its working for me now for V1.6. I didn't setup correctly earlier. Its a very good plugin. Thanks for your effort.

Is it possible to display the extra field value in Questions List page also?
by
Good.
> Is it possible to display the extra field value in Questions List page also?
You can display by calling qa_db_postmeta_get() in qa-include/qa-db-metas.php from q_item_main() of theme layer.
1st argument: question id.
2nd argument: "qa_q_extra?" '?' is number of "Enable field<<<1>>>" of admin panel.
Please study the detailed coding method in other threads.
by
zip is broken cant open :(
by
I fixed it. Please re-download.
by
@sama55: How did you put the attachments side by side in the screenshot above?
By the way, Thanks for this great plugin.
by
Refer to "Admin" > "Plugins" > "Extra Question Field" > "Enable fieldX"
  "Show on question page" <<< ON
  "Label on question page"
  "Position on question page"
  "Hide on question page if blank"

This action is same with "Admin" > "Posting".
  "Show the extra information on question pages with label:"
by
@sama55: I already did that before. My question is about the "side by side" displaying. My attachments are below each other, not side by side.
by
You can layout with style sheet of your theme. e.g.
.qa-q-view-extraX {
  float:left;
}
.qa-q-view-extra-titleX {
  display:block;
  margin-right: 10px;
  margin-bottom: 10px;
}
by
edited by
Hello guys...

I'm new on Q2A area, and i'm really enjoying all the support and efforts coming from so many users to help everyone....


I have a question regarding this plugin....

I'm creating a website, and I just found this plugin who might be my solution. I need to create a listbox field (so far, so good), but later I need to retrieve all the questions related to the options from this listbox....

like in this example....

I have a color listbox on my form... ok? So, after a while, I will need to retrieve all questions regarding these colors coming from this listbox .... is there a way to do this?

Actually, it doesn't matter if it is as a menu option or work as a category.... i only need to retrieve everything related....

Is there a way to do this??


Cheers =D

@sama55.... mind to help me here? =)
by
Your post is a new question. You should make a new thread.
Probably, you can retrieve related questions by selecting qa_post with "inner join qa_postmetas".
by
the download link is not working (forbidden message)
by
I want your plugin Extra Question Fields
by
Download link is broken
by
Sama - As others have said the link is broken.
by
All the download links for your plugins are broken.
I hope this can be fixed.
by
Anybody know where we can find the code to this plugin?
by
How do I add this extra question field in answer form?
by
Would this work with ver 1.8.2?
by
This plugin is outdated, and is no longer maintained as the author left Q2A community haft a decade ago.

In short: doesn't work!

9 Answers

+4 votes
by
Nice plugin but one thing! Is there a way to hide the label on question page if there is no input?
by
Thank you VdoubleE for your opinion. I try improvement.
by
Perfect! This plugin is so needed thanks for listening!
+1 vote
by
Really excellent work !!

I just hope that we will have one day as well an image-field or gallery-field so we can use q2a in so many other ways.

Classifieds for example...

Thank You !!
by
Thank you monk333 for your opinion. Like forum-CMS(Bulletin board etc), it is good that  files can be attached "easily" by extra field. I feel that Jatin was developed plugin which attaches voice file too. I will further develop.
+1 vote
by
Hi sama55,
This is great!
I am looking for a way to add titles to answers and it seems that adding your text field would do the trick. Is there an easy way to also apply this feature on answers?
Would most appreciate your elaborate answer (as much as you can)
Thanks in advance.
by
Thanks karo. qa_postmetas table key is postid. Therefor, I think that you can add extra fields to answer, if you make other plugin mimicking my plugin.
by
Yeah that's the idea,
I`m new to Q2A and still trying to figure out where are the relevant values for answer form and question form and replace the two.
Would most appreciate your help on this
by
Yes i'm also facing trouble with applying this plugin to answers also. i know that i need to copy this plugin, give it a different name but what to change inside?
+1 vote
by
I have one question for this plugin, that should we have to set a particular value of attachment fields or with every attachment a next attachment file option will come forward?
+1 vote
by
Hi Sama
 
In your filter file, you have a process_event function where you declare a global $qa_extra_question_fields. You then test if it's set.
 
My questions are:
 
1) Will it ever be set?
2) Will it issue a warning if testing on a variable index not set?
 
Thanks!
 
function process_event ($event, $userid, $handle, $cookieid, $params) {
   global $qa_extra_question_fields;
   switch ($event) {
      case 'q_queue':
      case 'q_post':
      case 'q_edit':
         for($key=1; $key<=qa_eqf::FIELD_COUNT_MAX; $key++) {
            if((bool)qa_opt(qa_eqf::FIELD_ACTIVE.$key)) {
              $name = qa_eqf::FIELD_BASE_NAME.$key;
              if(isset($qa_extra_question_fields[$name]))
                 $content = qa_sanitize_html($qa_extra_question_fields[$name]['value']);
              else
                 $content = qa_db_single_select(qa_db_post_meta_selectspec($params['postid'], 'qa_q_'.$name));
              if(is_null($content))
                 $content = '';
             qa_db_postmeta_set($params['postid'], 'qa_q_'.$name, $content);
         }
    }
    break;
    case 'q_delete':
        for($key=1; $key<=qa_eqf::FIELD_COUNT_MAX; $key++) {
            if((bool)qa_opt(qa_eqf::FIELD_ACTIVE.$key)) {
               $name = qa_eqf::FIELD_BASE_NAME.$key;
               qa_db_postmeta_clear($params['postid'], 'qa_q_'.$name);
           }
       }
       break;
   }
}
by
Since I do not watch your output HTML, I do not understand detailed things. Probably it will be a basic problem irrelevant to Q2A.

http://www.php.net//manual/en/features.file-upload.post-method.php
https://www.google.co.jp/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=input+file+_FILES+empty
by
Hmmm, can it be the difference in the way the forms are submitted? When I submit a question the page is reloaded, but when I submit an answer/comment the page is not reloaded (it's ajax right)? Could that be the reason the $_FILE is empty when the process_event (in the event file) is called for comments/answers?
by
After further investigation, I don't think it's possible to do this file upload for answer/comment at all. Since answers/comments are not really submitted (but saved via ajax), there is no way the $_FILES is set.
by
I think this will work, however it's not easy: In the form for answer/comment, add an iframe. The iframe contains an extra form with just an input of type FILE (style it so the user won't notice the iframe) for the user to select a file to upload. Action on the form in the iframe is set to our own php-file. This php will take care of saving the file to the database. When submit button is triggered on answer/comment form (catch in new plugin -> events), we programmatically trigger the iframe submit.

Some of this ugly workaround could have been avoided if Q2A was upgraded to HTML5. Then I could have used Ajax upload plugins. I don't understand why Q2A is still running HTML4.01 - it's not like HTML5 is cutting edge :-)
0 votes
by
helo sama,

thanks for your work. i just tried to use EQF with q&a1.7 and don't seem to get it to work. i can configure the plugin in the admin section to show one file upload field, but it doesn't show up when asking a new question.

when enabling "Input is required" i get an error when trying to post a question, so it seems the plugin is active somehow only i don't see any field that i could input as a user.

is there anything i could be doing wrong?
by
This is running correctly in my environment. If there is not more detailed information, it is difficult to advice. e.g. Error contents, your theme, other plugin, etc.
by
ah, thanks for the hint: i removed all other plugins and found http://peatarian.com/blob/loginrequirement.zip as mentioned here: http://www.question2answer.org/qa/26289/how-can-i-hide-all-info-when-users-are-not-authenticated?show=26289#q26289 to be the culprit.

if i remove that plugin, yours works.
any idea how to fix that?

or an other idea to hide the questions page to unauthorized users?
by
edited by
Your code is wrong. If you call the below line in somewhere in your main function, my plugin will work correctly.
qa_html_theme_base::main();
Or, your two changes should be processed at the first of the two functions.
page_title_error() and main_parts()

Coding method of correct layer function:
http://www.question2answer.org/layers.php
Point: If you want to ensure compatibility with other plugins, you will need to call the same named parent function. e.g.
qa_html_theme_base::nav_list($navigation, $navtype);
qa_html_theme_base::head_script();
qa_html_theme_base::post_tag_list($post, $class);
qa_html_theme_base::post_meta_who($post, $class);
by
i am afraid i didn't write that code myself and am not familiar with php...anyway i tried to follow your advice and put the line
 qa_html_theme_base::main();
in line 13 of qa-login-requirement-layer.php

looks like so:
...
    function main()
        {
            qa_html_theme_base::main();
            $content=$this->content;
...

now your plugin indeed works, but this plugin is broken in that questions are now visible to unauthorized users. any more hints you could give me?
0 votes
by

Hey @sama55 !

Great plugin! I was wondering and already asked here on Q2A, how can I use Markdown/CKEditor4 instead of using the simple normal default editor on the text area field?

0 votes
by
Thanks for the plugin!

 

How can I allow only registered users to upload files?
0 votes
by
Hello, does anybody still have the source code for this plugin? because when I press the download button nothing happens and thank you.
by
Thank you, and also do you have an idea on how to make this plugin work on answers too and not only questions?
...