Drupal version: 6.15
Webform version: 6.x-3.0-beta1

Because i wanted to use the "select | other" options I upgraded my webform module form 6.x-2.9 to 6.x-3.0-beta1.
I started getting the following error messages:
- The webform component textfield is not able to be displayed. (on view tab)
- The webform component of type textfield does not have an edit function defined. (on webform tab)

These concern the textfield elements, but the same occurs when adding a textarea.

What i did:
- delete all notices of webform from filesystem and database, removed and uninstalled module.
- flushed all caches / updated the database.
- uploaded webform, enabled module, flushed cache and updated database again.
- module seems to work properly except for the above mentioned noticifications.
- the fields I add do appear in the webform tab and stay there.

Any suggestions what I should / could do?

CommentFileSizeAuthor
#12 webform_include_php51.patch831 bytesquicksketch

Comments

quicksketch’s picture

It sounds like the "textfield.inc" file is missing from your webform installation. It should be in "webform/includes/textfield.inc". The warnings you are receiving occur when Webform cannot find the functions needed to edit/view a specific component type. You might also check that "textfield" is an enabled component under admin/settings/webform.

quicksketch’s picture

3.x also has a very bad bug where visiting admin/settings/webform will make it look like ALL components are disabled (even if they are enabled). Make sure to check all of the boxes when changing the settings every time, or apply the patch from #726670: All components is disabled/unchecked on settings page.

sjoert’s picture

Thnx for the replies.

Are you sure it shouldn't be in the webform/components folder? Anyway, i've put all the .inc's in both maps. Flushed and updated, but it doesn't seem to work.

All the components were checked (enabled) in my admin section. Switching them off and on again doesn't matter. I've applied the patch but this doens't change anything as well.

Anyone else got this problem? Or am I off to a fresh install?

quicksketch’s picture

Oh yeah, I mean "webform/components", not includes. Unless this can be reproduced from a fresh install, I don't know how else I can help. It sounds like a classic case of a corrupted upload though. For whatever reason, Webform can't find those functions.

allan1015’s picture

I've tried beta1 and beta2, fresh installs (complete deletes between them) and getting the 'Cannot be Displayed' error on text, date and other fields.

other then not showing up in views, everything else about webform components seems to work

There are no javascript errors thrown.

No errors in any log files, the ones ion drupal and apache logs

I tried Bluemarine and other themes, same thing

I renamed the webform/components directory and the error stayed the same? Was expecting a missing directory to cause some issue? Its like the error happens before it even tries to access the component directory

I put an error message in the function webform_component_invoke and it definitely thinks that:
# The webform function _webform_defaults_textfield does not exist
# The webform function _webform_render_textfield does not exist
(When textfield was supposed to be displayed)

I have a basic acquia-drupal setup

I checked the components directory chown and chmod values, looks like it should work, not a permissions problem

Where in the code do the component/*.inc files get loaded for the node? I'll see if I figure out if that part fails, just to hard for me to reverse engineer.

quicksketch’s picture

When a field needs to be displayed (or edited), Webform calls webform_component_invoke('textfield', 'display'), which then calls webform_component_include(), which should be responsible for pulling in the file.

I still can't reproduce this on a fresh install. Make sure when you "complete delete" the module that you truly "uninstall" the module (admin/build/modules/uninstall) before you throw it away.

sjoert’s picture

Could it be a php version error? Because this is getting ridiculous ; )

What I did:
- make a new database
- create a new folder on server
- put a full fresh drupal install in the folder.
- install webform only and create form.
= same problem

Which leads me to believe it can hardly have anything to do with the Drupal installation or database. So, could it be php? The webserver is running version 5.1.6 ... (On MAMP with 5.2 it does work, you see)

quicksketch’s picture

Hmm, I suppose. But I don't know any reason why Webform would not work with PHP 5.1. I'd be more inclined to think it's a server configuration thing rather than the version of PHP itself. Though configuration problems that cause Webform to fail like this have been rare in the past.

allan1015’s picture

Heres what I know so far, hope it helps thought its crazy

in the webform_component_include function
the module_load_include call is retuning a false

I saw that the $path parameter was just set to 'components/' there was no filename

From that I found that this call $pathinfo = pathinfo($info['file']);
was returning a null for $pathinfo['filename']

The input from $info['file'] looks fine as 'components/textfield.inc'

The $pathinfo['dirname'] is fine as 'components'
The $pathinfo['basename'] is fine as 'textfield.inc'
The $pathinfo['extension'] is fine as 'inc'

So pathinfo() is not working as expected??? Truly wierd?

Its wierder
after thepathinfo() call I added this line
$pathinfo['filename'] = str_ireplace('.'.$pathinfo['extension'],'',$pathinfo['basename']);

Which set filename = 'textfield'
So the $path going to module_load_include as now = 'compoment/textfield'

THIS NOW WORKS!!!
Now idea why pathinfo() is failing???

Allan

Mike Dodd’s picture

I to am having the smae problem.

I fixed it by copying the render function from textfield.inc into the module so it is simply that it can't locate the mdoule.

quick fix for this would be

if (function_exists($function)) {
return call_user_func_array($function, $args);
}

to

if (function_exists($function)) {
return call_user_func_array($function, $args);
}else{
include("components/$type");
return call_user_func_array($function, $args);
}

This will force it to include the inc file and so will display the fileds.

Sorry i dont have time to fix this properly but its gone midnight and I still have shipments to do :(

Again php 5.16 on a Centos server.

hope this helps someone.

quicksketch’s picture

Title: The webform component of type x does not have an edit function defined. » The webform component of type x does not have an edit function defined when using PHP 5.1
Version: 6.x-3.0-beta1 » 6.x-3.0-beta2
Category: support » bug

Apparently PHP's documentation (http://us.php.net/pathinfo) implies that "filename" is not available with this Changelog description:

5.2.0  	 The PATHINFO_FILENAME constant was added.

Which is a bit of a funny way of saying that "filename" is only available in 5.2 and higher. We should be able to make this 5.1 compatible with a small change and just use the basename() function on $info['basename'].

quicksketch’s picture

Status: Active » Fixed
StatusFileSize
new831 bytes

Committed the attached patch which should address this issue in PHP 5.1.

allan1015’s picture

Just FYI, tested and it works
Glad I could help

Allan

Mike Dodd’s picture

I to have just tested this patch and it works beautifully, thank you very much.

sjoert’s picture

Status: Closed (fixed) » Fixed

This is great work guys, thanks so much i got everything up and running as well.

@quicksketch, you're the man! version 3 is a massive improvement!

summit’s picture

Working great @quickscetch!

greetings, Martijn

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

1sp’s picture

Version: 6.x-3.0-beta2 » 6.x-3.0-beta5
Status: Fixed » Active

The problem is still there.

I tried webform 6.x-3.0-beta5 (php version 5.1.6)

Regards,
Sudhir

quicksketch’s picture

sudhirporwal, please provide steps to reproduce the issue and include what version of PHP you are using.

1sp’s picture

I took the following steps.

- I disabled and uninstalled the previously installed webform-6.x-2.9 module.
- I removed the "webform" folder from the source tree(sites/all/modules).
- Downloaded webform-6.x-3.0-beta5 from http://ftp.drupal.org/files/projects/webform-6.x-3.0-beta5.tar.gz.
- Extracted the module in sites/all/modules and enabled the module.
- In the webform module settings , I choose a content type(A) to be webform enabled.
- I created a node of type (A), Then I went to its "Webform" tab and tried to add a File field.
- After clicking add button , I was taken to a form on top of which a drupal message mentioned in the issue was there.

quicksketch’s picture

Did you run update.php after upgrading to 3.x?

1sp’s picture

Hi,

I did a new install of the module after uninstalling the older version and deleting the files. So a run of update.php was not necessary.

quicksketch’s picture

Hmm, so this is basically a clean install? I can't reproduce this problem with either the file component or any other fields. Does this happen for all component types?

quicksketch’s picture

Status: Active » Closed (fixed)

Re-closing after lack of response. Please open a new issue instead of reopening this one if the problem occurs again.