Comments (14)
Hi,
Can you please edit the class to print out the value of
$this->includesRelativePath
Just modify the class and edit at
public function elementsToString($includeTableTags = true)
{
and put under it
die($this->includesRelativePath);
And post the output here, thanks!
Original comment by [email protected]
on 12 Apr 2010 at 2:39
from php-form-builder-class.
/community2/components/com_agenda/php-form-builder-class/includes
'community2' is the root of my joomla installation. 'com_agenda' is the
component i
am building. the full path is something like /home/tom/HTML/community2/...
Original comment by [email protected]
on 12 Apr 2010 at 2:56
from php-form-builder-class.
Hi thanks, for your report, this is caused because you are using a absolute path
instead of a relative path.
Perhaps the should be changed to includesPath and have a function to check if
it is a
relative path or a absolute path to make the decision if the path is set
incorrectly.
For now you can comment out the two lines in the class while we fix it:
if(empty($this->includesRelativePath) ||
!file_exists($this->includesRelativePath) ||
!is_dir($this->includesRelativePath))
$str .= "\n\t" . '<script type="text/javascript">alert("php-form-builder-class
Configuration Error: Invalid includes Directory Path\n\nUse the
includesRelativePath
form attribute to identify the location of the inclues directory included
within the
php-form-builder-class folder.");</script>';
to stop the warning.
Original comment by [email protected]
on 12 Apr 2010 at 3:00
- Changed state: Accepted
- Added labels: Priority-High
- Removed labels: Priority-Medium
from php-form-builder-class.
Here is a change to the logic so it checks absolute paths and relative paths:
if(empty($this->includesRelativePath) || !is_dir($this->includesRelativePath)
&& (!file_exists($this->includesRelativePath) &&
!file_exists($_SERVER['DOCUMENT_ROOT'].$this->includesRelativePath) ))
$str .= "\n\t" . '<script type="text/javascript">alert("php-form-builder-class
Configuration Error: Invalid includes Directory Path\n\nUse the
includesRelativePath
form attribute to identify the location of the inclues directory included
within the
php-form-builder-class folder.");</script>';
Original comment by [email protected]
on 12 Apr 2010 at 3:28
from php-form-builder-class.
Original comment by [email protected]
on 12 Apr 2010 at 5:15
- Changed state: Started
from php-form-builder-class.
Tom,
Thanks for your support of this project.
The includes directory contains both javascript and php components that are
used by the class. An absolute
path in a javascript environment differs from that in a php environment because
the initial slash is interpreted
differently. In javascript, the slash begins at the document root while in php
the slash represents the root
directory of the web server. Because of this difference, a relative path is
used to identify the includes
directory. This way, both javascript and php and share the same path.
Just because the javascript alert error message is suppressed doesn't
necessarily mean that the includes
directory is correctly identified for both javascript and php.
- Andrew
Original comment by [email protected]
on 12 Apr 2010 at 1:55
from php-form-builder-class.
Thanks Andrew.
you are right, i've changed to a relative address. but the real problem is
still there.
here's the relative address that works (ie: loads the javascripts for TinyMCE,
etc.)
incudesRelativePath" => "components/com_agenda/php-form-builder-class/includes"
but it doesn't make your safety-check happy (ie: it pops up the message "invalid
Includes Directory Path"). the relative path that makes the error go away is
simply:
incudesRelativePath" => "includes"
but that doesn't load the javascripts (ie: doesn't work).
i commented out the error message.
Original comment by [email protected]
on 12 Apr 2010 at 3:21
from php-form-builder-class.
Should have thought of that...
you can have an absolute path and it will work perfectly fine... except for
when the
class does
require_once($form->includesRelativePath . "/recaptchalib.php");
So you would need to change that... you could check if the path starts with /
and if
it does slap on $_SERVER['DOCUMENT_ROOT'] ...
It becomes a problem specifying the relative path if you are messing around with
mod_rewrite or including forms from random directories.
So I think its necassary to get absolute paths working.
Andrew, do you want me to go in and make all the php side stuff work with
absolute
paths + use my patch for the javascript error check?
Cheers,
moncojhr
Original comment by [email protected]
on 12 Apr 2010 at 5:30
from php-form-builder-class.
moncojhr,
I think a good approach would be to...
1. Change the includesRelativePath attribute to includesPath to remove any
confusion on if the path is relative
or absolute.
2. Allow both relative and absolute paths to be handled correctly. If the
includesPath attribute does not begin
with a slash, it is handled as it is currently in version 1.0.2. If there is
an initial slash in the includesPath
attribute, then we need to determine if the user is beginning the path from the
server root or document root.
This could turn out to be easier said than done, but it's worth a shot. One
way to implement would be to put
all of these conditional checks at the start of the elementToString() function,
which is where the current js alert
in question is. Then two private form attributes (jsIncludesPath and
phpIncludesPath) could be set for future
use in the class. This approach eliminates the need to check the path multiple
times throughout the form
building process.
3. Leave the default value as it is currently in version 1.0.2 which
identifies the path as relative. For most
developers using this class, the default value will prevent them from having to
define this attribute when
building forms. If we switch the default value to assume an absolute path, my
fear is that more people will
have to include with attribute in each of the forms they build.
Original comment by [email protected]
on 12 Apr 2010 at 8:42
from php-form-builder-class.
Tom,
Unfortunately, I do not have experience using Jumla! which makes it a challenge
for me to provide you with setup
advice. Adding support for absolute paths may or may not remedy your issue.
One thing you may try is to create
a symbolic link of the php-form-builder-class directory to satisfy the path
discrepancies.
- Andrew
Original comment by [email protected]
on 12 Apr 2010 at 8:49
from php-form-builder-class.
Hi Tom, in the SVN version i've added a patch so you can use absolute and
relative
paths now.
Can you please get the SVN version and test it?
It should work when you use "includesPath" => JURI::base( true )
."/components/com_agenda/php-form-builder-class/includes"
Note that the variable name includesRelativePath is deprecated in favour of
includesPath now.
Original comment by [email protected]
on 14 Apr 2010 at 5:02
from php-form-builder-class.
includesPath worked like a charm. :)
includesRelativePath no longer gives an error when i give it the
/component/com_agenda/... string, either in absolute or relative (the old
behavior
was that it worked but gave an erroneous error).
includesRelativePath behaves the same as before when i give it 'includes' (ie:
doesn't complain but doesn't work).
it's all good.
thank you.
Original comment by [email protected]
on 14 Apr 2010 at 1:33
from php-form-builder-class.
Hi, just to let you know includesPath works with absolute and relative paths,
but in
your circumstance you dont know where the form is going to load so you cant use
a
relative path.
includesRelativePath is just set to includesPath for the moment so it wont break
anyone's form and will eventually be removed.
Thanks for testing!
Original comment by [email protected]
on 15 Apr 2010 at 2:58
- Changed state: Verified
from php-form-builder-class.
hi , i just uploaded the pfbc and the same problem is being display throw fire
bug in "CKEDITOR is not defined" what should i do :(
Original comment by [email protected]
on 27 Jan 2012 at 9:53
from php-form-builder-class.
Related Issues (20)
- Default value for a radio button HOT 2
- add custom ajax
- Submitting Obejcts as JSON strings instead of traditional POST
- Error Submit Ajax form
- Form Builder Class Submit Button - No Value HOT 8
- Multiple Select - Multiple values not showing as pre-selected HOT 1
- Update to Bootstrap 3 HOT 4
- Doesn't update if Google Spreadsheet Column Name is a Number
- send and receive data to-from mysql db
- javascript load multiple times in pfbc(PHP Form Builder Class - Imavex) HOT 1
- Element Select and text value
- Radio buttons HOT 2
- Bootstrap 3 support
- Nginx ajax file upload error HOT 1
- How to add selected="selected" on Select with PFBC 3.1? HOT 3
- How to compare two elements's values (e.g. password / password new)
- How to compare user entered element value with DB content?
- accentuation on the placeholder
- Custom CSS
- Having a multiple default in a Multiple Select
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php-form-builder-class.