Undefined index: input_captcha

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Locked
FCazabon
Forum Members
Forum Members
Posts: 165
Joined: Fri Nov 07, 2008 5:28 pm

Undefined index: input_captcha

Post by FCazabon »

I am trying to put Captcha on my forms and I get this Notice:

Notice: Undefined index: input_captcha in /home/www/arrivealivett.com/lib/smarty/libs/sysplugins/smarty_internal_templatebase.php(151) : eval()'d code on line 199

I am using the reCaptcha option and have got and implemented the various keys from Google.

Any idea what I am doing wrong?

Cms Version: 1.11.13
Installed Modules:
CMSMailer: 5.2.2
CMSPrinting: 1.0.5
FileManager: 1.4.5
MenuManager: 1.8.6
MicroTiny: 1.2.9
ModuleManager: 1.5.8
News: 2.15
Search: 1.7.12
ThemeManager: 1.1.8
Gallery: 2.0.2
FormBuilder: 0.8.1.1
CGExtensions: 1.47.3
FrontEndUsers: 1.28
Captcha: 0.5.2
CustomContent: 1.10
Quotes: 1.0
CGSimpleSmarty: 1.8
JQueryTools: 1.3.5.2
CGBlog: 1.12.10
Forum: 0.9.2

Config Information:
php_memory_limit:
process_whole_template:
max_upload_size: 10000000
url_rewriting: none
page_extension:
query_var: page
image_manipulation_prog: GD
auto_alias_content: true
locale:
default_encoding: utf-8
admin_encoding: utf-8
set_names: true

Php Information:
phpversion: 5.4.39
md5_function: On (True)
gd_version: 2
tempnam_function: On (True)
magic_quotes_runtime: Off (False)
E_STRICT: 0
E_DEPRECATED: 0
memory_limit: 128M
max_execution_time: 60
output_buffering: 4096
safe_mode: Off (False)
file_uploads: On (True)
post_max_size: 10M
upload_max_filesize: 10M
session_save_path: /tmp (1777)
session_use_cookies: On (True)
xml_function: On (True)
xmlreader_class: On (True)

Server Information:
Server Api: cgi-fcgi
Server Db Type: MySQL (mysqli)
Server Db Version: 5.5.38
Server Db Grants: Found a "GRANT ALL" statement that appears to be suitable
Server Time Diff: No filesystem time difference found
FCazabon
Forum Members
Forum Members
Posts: 165
Joined: Fri Nov 07, 2008 5:28 pm

Re: Undefined index: input_captcha

Post by FCazabon »

I have tracked it down to this line:

Code: Select all

</td><td><?php echo $_smarty_tpl->tpl_vars['input_captcha']->value;?>
which is in this file:

tmp/templates_c/FormBuilder^2c89f31d43834bdf5005666f73b54ee628239dab.module_db_tpl.FormBuilder;fb_6.php on line 199

can anyone point me to where that line/file is being generated from and what I should do to fix it? Maybe isset() around it?
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1978
Joined: Mon Jan 29, 2007 4:47 pm

Re: Undefined index: input_captcha

Post by Jo Morg »

From the looks of it, it seems you have upgraded from an old FormBuilder version and are using a template for a form that uses a very old version of reCaptcha too. FormBuilder has changed the way it uses the reCaptcha library since it generates its own input and doesn't use (and hence doesn't require) an input in the form own templates in cases that the user selects to use this library over the others. The new sample templates reflect this change, but in an upgrade we don't re-install these.

The best way to solve this would be to use this bit of Smarty logic instead of the one you have on your template (I'm assuming it would be a form with the id of 6) regarding the captcha inclusion:

Code: Select all

    {if isset($has_captcha) && $has_captcha == 1}
        <div class="captcha">
         {$graphic_captcha{$title_captcha}
         <br />
         {if !empty($input_captcha)}{$input_captcha}{/if} {* this is the important bit *}
       </div>
    {/if} 
Additionally, the new Captcha uses reCaptcha v2 which uses different pairs of keys than the older V1 (just a reminder), so make sure you have the correct set of keys for this version otherwise reCaptcha won't work.

Finally: all files inside tmp/templates_c are generated by Smarty either by core request or by modules request (meaning by proper use of Smarty methods to compile the templates), which means that any change of the files inside it (other than by means of clearing the CMSMS cache or deleting these files for the same purpose) or changing the files responsible for its generation (other than by changing the templates that are made available to be customized by the core or the modules themselves) would violate the rules of the forum, and render that particular installation of CMSMS not eligible for official support. In any case that wouldn't be the solution...

HTH
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
FCazabon
Forum Members
Forum Members
Posts: 165
Joined: Fri Nov 07, 2008 5:28 pm

Re: Undefined index: input_captcha

Post by FCazabon »

Thanks,

using

Code: Select all

{if !empty($input_captcha)}{$input_captcha}{/if}
made my template work.

I don't know about the upgrading from an old version as this was a new install.

Thanks for the explanation regarding the template generation. I wasn't planning on changing the templates, just wanted to understand how they are generated so that I could try to understand where this notice was coming from :)
Locked

Return to “Modules/Add-Ons”