This is the community forum. For a developer response use the Client Area.
Follow us on Facebook, Twitter and YouTube!

Additional dropdown field
#1

Is it possible to add an additional custom dropdown box possibly below the country field with a list of my own selections?

Thanks.
Reply
#2

Hi Classkeeper,

It's possible but currently you would have to edit the code (in a future version there will be admin panel settings to do this).

So just add the HTML for your new select input in /upload/includes/template/form.php

Then add some code to /upload/includes/app/processor.php to make sure it's submitted and sanitized. Further down the file, you'll need to adjust the INSERT comment query to include the value of the select input.

Obviously you would also need to add a new column to the comments database table.

Have you completed the interview?
Reply
#3

Hi Steven,
I followed your advice to Classkeeper above and edited form.php, processor.php and also added a new corresponding column in the comments database table. However, my new field does not appear on any forms, new or old. Could there be more files involved that need to be edited?

What I did was basically use the country code & countries.php file from the country dropdown since my new field needs to be a dropdown. There are no errors or anything, the new field just doesn't appear anywhere.  I am wondering if the new field would need to appear in the dashboard so that it could be enabled or something?
Reply
#4

Hi Randy,

Can you attach the files that you've changed and I'll have a look when I next get chance.

Have you completed the interview?
Reply
#5

(19-Sep-2014, 07:32 PM)Steven Wrote:  Hi Randy,

Can you attach the files that you've changed and I'll have a look when I next get chance.

Thanks Steven!
They are attached.  One thing I did notice is that when I added "relationship" as case '1'  (line 933 in form.php) and renumbered the other cases accordingly, the rating dropdown disappeared. So I just reverted the numbers and added "relationship" as case '7'.  The ratings dropdown then appeared again.  So I'm wondering there needs to be an accommodation for the new 7th case somewhere in the system so that it's acknowledged.

Regards,
Randy


Attached Files
.php form.php Size: 57.87 KB  Downloads: 14
.php relationships.php Size: 1.51 KB  Downloads: 11
.php processor.php Size: 33.19 KB  Downloads: 11
Reply
#6

Hi Randy,

Hopefully this will be of help.


Attached Files
.zip upload.zip Size: 38.7 KB  Downloads: 38

Have you completed the interview?
Reply
#7

This is working great...Thank You much!   Shy
One small thing I noticed on the cookie/autofill now. It appears that the autofill is off by one field now and still showing the website autofill, even though I have that field hidden. (see attached)


Attached Files Thumbnail(s)
   
Reply
#8

For the cmtx_load_form_cookie() function in /includes/functions/form.php try this:

PHP Code:
<?php 
function cmtx_load_form_cookie() { //load cookie form field values
global $cmtx_default_relationship, $cmtx_default_name, $cmtx_default_email, $cmtx_default_website, $cmtx_default_town, $cmtx_default_country; //globalise variables
if (isset($_COOKIE['Commentics-Form']) && cmtx_strlen($_COOKIE['Commentics-Form']) < 500) {
$values = explode('|', $_COOKIE['Commentics-Form']);
if (
count($values) == 6) {
$cmtx_default_relationship = $values[0];
$cmtx_default_name = $values[1];
$cmtx_default_email = $values[2];
$cmtx_default_website = $values[3];
$cmtx_default_town = $values[4];
$cmtx_default_country = $values[5];
}
}
}
//end of load-form-cookie function

Have you completed the interview?
Reply
#9

Perfect!  That fixed everything and makes sense now that I see where that code is.
Thanks again!!   Smile  Smile
Reply


Possibly Related Threads…
Thread / Author Replies Views Last Post
Last Post by Emprador
27-May-2016, 09:53 PM
Last Post by 2hands
24-Jun-2012, 08:56 PM
Last Post by Steven
15-Oct-2011, 05:53 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)