The following warnings occurred:
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
File Line Function
/global.php 783 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
File Line Function
/global.php 783 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined variable $newpmmsg - Line: 40 - File: global.php(841) : eval()'d code PHP 8.1.31 (Linux)
File Line Function
/global.php(841) : eval()'d code 40 errorHandler->error
/global.php 841 eval
/printthread.php 16 require_once
Warning [2] Undefined array key "style" - Line: 909 - File: global.php PHP 8.1.31 (Linux)
File Line Function
/global.php 909 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined property: MyLanguage::$lang_select_default - Line: 5024 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 5024 errorHandler->error
/global.php 909 build_theme_select
/printthread.php 16 require_once
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions.php 5044 is_member
/global.php 909 build_theme_select
/printthread.php 16 require_once
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1370 fetch_forum_permissions
/printthread.php 76 forum_permissions
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error



Form Tools
Help? - Printable Version

+- Form Tools (https://forums.formtools.org)
+-- Forum: Form Tools (https://forums.formtools.org/forumdisplay.php?fid=1)
+--- Forum: API (https://forums.formtools.org/forumdisplay.php?fid=17)
+--- Thread: Help? (/showthread.php?tid=145)



Help? - stevenheidel - May 8th, 2009

No matter how much I try to add a single page form through the api it will not work! I am on the first step of the tutorial asking me to add that php code and I always get the error:

Fatal error: Call to undefined function ft_api_init_form_page()

I have the api installed fine, and the require_once path is correct. Help?


RE: Help? - Ben - May 9th, 2009

Hmm... it does *sound* like the require_once() path is incorrect, I must confess. That function is defined in api.php, so if the file is included properly you should never see the error.

Try switching between a relative and absolute path and see if that helps.

- Ben


RE: Help? - stevenheidel - May 9th, 2009

(May 9th, 2009, 12:57 PM)Ben Wrote: Hmm... it does *sound* like the require_once() path is incorrect, I must confess. That function is defined in api.php, so if the file is included properly you should never see the error.

Try switching between a relative and absolute path and see if that helps.

- Ben

That's what I thought too... but, when I changed the path to something I knew was wrong I got this instead:

"Warning: require_once(/election/database/global/api/api.php) [function.require-once]: failed to open stream: No such file or directory"

So I know the other path was correct (and absolute)

Maybe this will help:

I'm building my website with a CMS called concrete5 and in order to execute code when I website loads it needs to be part of another function. The entire code is here:

PHP Code:
<?php
class CandidatesRegistrationController extends Controller {
    public function 
on_start() {
        require_once(
"http://election.cya-ajc.ca/database/global/api/api.php");
        
$fields ft_api_init_form_page("""test");
        
$params = array(
              
"submit_button" => "submit",
              
"next_page" => "/success.php",
              
"form_data" => $_POST,
              
"finalize" => true
            
);
        
ft_api_process_form($params);
    }
}
?>

Any more thoughts?


RE: Help? - Ben - May 9th, 2009

Ah! Any time you include() or require() files you need to use server paths, not URLs. If you can't figure out the right absolute path (I've been there!) try a relative one instead - but make sure its relative from the CALLING page, not the file containing the class. If you're calling that class from multiple pages, you'll need to doctor the class like so:

PHP Code:
<?php
class CandidatesRegistrationController extends Controller {
    public function 
on_start() {
        
$curr_folder dirname(__FILE__);
        require_once(
"$curr_folder/../path/to/database/global/api/api.php");
        
$fields ft_api_init_form_page("""test");
        
$params = array(
              
"submit_button" => "submit",
              
"next_page" => "/success.php",
              
"form_data" => $_POST,
              
"finalize" => true
            
);
        
ft_api_process_form($params);
    }
}
?>

But you'll need to update the relative path in the require_once() call for your setup. What that new code does is always compute the relative path to the api.php file from the file containing the class - not the original file that includes the class file.

Jeez that sounds confusing. Paths are always a nuisance to figure out... maybe the absolute path is the simplest!

- Ben


RE: Help? - stevenheidel - May 9th, 2009

Okay now I've got the paths correct. (Checked by my boss as well).

But your script keeps directing the page to error.php, which doesn't exist. Weird?

EDIT:

Oh I see, formtools directs you to this script when there is an error. Unfortunately, the error.php comes up in the same folder as the page itself, not in the formtools directory.

New code:

PHP Code:
<?php
class CandidatesRegistrationController extends Controller {
    public function 
on_start() {
        
$curr_folder dirname(__FILE__);
        require_once(
"$curr_folder/../../database/global/api/api.php");
        
$fields ft_api_init_form_page("""test");
        
$params = array(
              
"submit_button" => "submit",
              
"next_page" => "success.php",
              
"form_data" => $_POST,
              
"finalize" => true
            
);
        
ft_api_process_form($params);
    }
}
?>



Solved...ish - stevenheidel - May 13th, 2009

So I figured out from the folks at concrete5 (which, apart from being incompatible with formtools, is a great CMS) that all included scripts must be converted to libraries, which is impractical.

I simply solved this problem by putting the form in an iframe and all the candidate lists and api stuff in pop-ups, which is fine. It actually makes my site a little more clear. But anyways, thanks for your help, everything is working fine now through my workaround. Sorry about posting in the forum and submitting a bug and sending you an email Tongue.

(If you do stumble across a solution though, I'd be curious, but as I said I'm 100% fine with my workaround).


RE: Help? - Ben - May 13th, 2009

Hey Steven,

No worries at all - glad it got solved! And sorry for not responding in the bug tracker or here in the forums earlier. SO little time...

I would be interested in learning more about the way concrete5 requires the code, though. Having them as libraries doesn't seem like an outrageous requirement to me.

Another chap has been looking into creating Form Tools as a Joomla mod. Depending on how that goes, it may shed some light on solutions for other scripts. I'll be sure to post here if and when that ball gets rolling.

All the best -

Ben