The module allows a boolean type field within webform, with a return value if a checkbox is checked or not-checked.

This module was created as part of a client request to have the word 'No' returned if a certain checkbox was left unticked.

Core: Drupal 7
Project Page: http://drupal.org/sandbox/CTIDigital/1715136
Git: git clone http://git.drupal.org/sandbox/CTIDigital/1715136.git webform_boolean

Comments

gellweiler’s picture

I have activated your module and added a boolean type to a webform, but it will not render. It shows the message "The webform component boolean is not able to be displayed". It seems it trys to invoke "_webform_render_boolean" in webform.module:3540, which it can't find.
The git command posted in this issue queue will not work, because it contains your user, we can't authenticate as CTIDigital. This one should work:
git clone http://git.drupal.org/sandbox/CTIDigital/1715136.git webform_boolean.

pjcdawkins’s picture

Status: Needs review » Needs work

When I add a Boolean component to a new webform, I get the error:

Notice: Undefined index: extra in webform_component_edit_form() (line 547 of sites/all/modules/webform/includes/webform.components.inc)

I also get a Webform status message:

The webform component of type boolean does not have an edit function defined.

If I go back to the 'edit component' screen of the Boolean component, I get the above status message, and also the notices:

Notice: Undefined index: conditional_component in webform_component_edit_form() (line 547 of sites/all/modules/webform/includes/webform.components.inc).
Notice: Undefined index: conditional_operator in webform_component_edit_form() (line 557 of sites/all/modules/webform/includes/webform.components.inc).
Notice: Undefined index: conditional_values in webform_component_edit_form() (line 563 of sites/all/modules/webform/includes/webform.components.inc).

I don't get any form elements which allow me to define an 'on value' or an 'off value' for the component.

anthonyleach’s picture

Hi,

Thanks for the quick reply to this. A bit of a fail on my part, I ran the automated test as mentioned in the things to do before posting here, this told me to always prefix function names with the module name, but this seems to break the webform. I have checked the other webform components and these are not prefixed with the webform module name at all. I have reverted the re-naming of the function names and tested this functionality again (just like I should have done after changing the function names) and all seems back to normal.

Can you guys check this out, I have altered the git clone line from the initial post, bit of a copy and paste mistake :)

Thanks again!

pjcdawkins’s picture

Status: Needs work » Needs review

Ah that would explain it! I'll have another look [changing status]

gellweiler’s picture

Status: Needs review » Needs work

I have activated it. Seems to work now. It's a nice feature I think. You should add Screen shots to your projects page, so that people can see how the checkbox is going to look like.

gellweiler’s picture

Status: Needs work » Needs review

I didn't wanted to change status. I must have accidental hit the item in the list.

pjcdawkins’s picture

Status: Needs review » Needs work

When I add the new component, I get:

Notice: Undefined index: private in webform_component_edit_form() (line 442 of sites/all/modules/webform/includes/webform.components.inc)

As shown in the automatic review (http://ventral.org/pareview/httpgitdrupalorgsandboxctidigital1715136git), you have several functions that need to be namespaced correctly.

All functions need to start with your module name, i.e. with webform_boolean (with an underscore if you want to indicate they're private). So:

  • _webform_defaults_boolean() should be _webform_boolean_defaults_boolean()
  • _webform_render_boolean() should be _webform_boolean_render_boolean()

etc.

Note: these functions are not actual hook implementations - see the Webform module's comments in webform.api.php. So you can name these functions anything you like, provided they start with your module name in order to avoid conflicts.

anthonyleach’s picture

Hi,

Thanks for the info, I have just checked into this and it seems the webform module has it's own invoke function (webform_component_invoke) which does not prefix the module name before the function call.

Webform.module Line 3535

function webform_component_invoke($type, $callback) {
  $args = func_get_args();
  $type = array_shift($args);
  $callback = array_shift($args);
  $function = '_webform_' . $callback . '_' . $type;
  webform_component_include($type);
  if (function_exists($function)) {
    return call_user_func_array($function, $args);
  }
}

A callback of 'defaults' and a component type of 'boolean' would result in the function being '_webform_defaults_boolean'

Thanks
Anthony

anthonyleach’s picture

Just a quick note also, I have uploaded a screenshot of the component edit screen and also fixed the problem causing the notice.

Thanks
Anthony

pjcdawkins’s picture

Ah I see.

Not marking RTBC yet, because procedure would probably want me to say:

Your project page is not very detailed, please have a look at the tips for a great project page, you may also use HTML-tags for better structure.

anthonyleach’s picture

Hi,

I have added two new screen shots, one of the component display in the front end and the other of the display within the email body, I have also updated the known issue's section (a brief summary of the webform invoke function) and linked to the webform module and to the similar boolean field module.

Thanks
Anthony

pjcdawkins’s picture

Status: Needs work » Reviewed & tested by the community

The function namespace thing isn't really a serious problem for your own module - it's just unfortunate for Webform that it doesn't allow other modules to override each others' component settings, etc.

There's now a typo on the project page: "componenent".

Otherwise good enough for me.

anthonyleach’s picture

Hi,

Corrected the spelling mistake, what is the next step?

Thanks

pjcdawkins’s picture

See http://drupal.org/node/539608 - now it's marked RTBC, wait for a git admin to find this issue.

CTI Digital’s picture

Great! Thanks for your time

klausi’s picture

We are currently quite busy with all the project applications and I can only review projects with a review bonus. Please help me reviewing and I'll take a look at your project right away :-)

klausi’s picture

Assigned: Unassigned » klausi
klausi’s picture

Status: Reviewed & tested by the community » Fixed

Currently your sandbox is not listed on your user account, so check your Git setup and your account mail address. See http://drupal.org/node/1022156

Thanks for your contribution, CTI Digital!

I updated your account to let you promote this to a full project and also create new projects as either a sandbox or a "full" project.

Here are some recommended readings to help with excellent maintainership:

You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and get involved!

Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.

Thanks to the dedicated reviewer(s) as well.

Status: Fixed » Closed (fixed)

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

Anonymous’s picture

Issue summary: View changes

Changed the git clone command