Hi,

I'm trying to build a Performance Review form that will list 5 or 6 items in the left-side column, followed by some select options in the right-side column.

I have been able to create a Matrix with the left side column having fillable textfields, but I was wondering if there was a way to be able to add "readonly" textfields, so they basically just show up as Labels.

I know I can add a label, but it repeats itself for each subsequent row that is added. I need each row to be different, with the same select options.

Am I missing something?

Thanks!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

kyleheney’s picture

I guess this could be achieved if I could somehow flip the rows and columns... I just need to be able to define the individual rows like you can for the individual columns.

chetan-singhal’s picture

Hi kyleheney ,

Yes I can. But this will not a part of webform_matrix_component. If you require I can made this for you.

kyleheney’s picture

What do you mean?

I think the ability to flip rows/columns would be one that the other users of this module would like as well.

Perhaps a 2nd module called "Flipped Webform Matrix Component"?

chetan-singhal’s picture

yes something like that or where we can configure column as well as row.

kyleheney’s picture

That would be great. Can you post a link to it here once completed?

chetan-singhal’s picture

Status: Active » Closed (works as designed)

If you wanna fixed this mail me chetansinghal1988@gmail.com

sanderss77’s picture

I have the same need to have separate labels for each row. I have tried to find a solution for this together with the webform component but havent had any success. I tried the webform table module but it didnt work at all with the newest release of webform.

I have attached an image that you can take a look at.

chetan-singhal’s picture

This is enhancement I will add this my next release.

sanderss77’s picture

Very good, let me know when you have added the row feature in the next release. I can test the feature for you an d give feedback.

sanderss77’s picture

Very good, let me know when you have added the row feature in the next release. I can test the feature for you an d give feedback.

chetan-singhal’s picture

I am not planning next few days. If you require this feature let me know.

benjaminarthurt’s picture

This feature seems like a must have for a module like this. I'd love to see it as well. I'll start looking at the code and If I come up with something useful will submit a patch.

sanderss77’s picture

Yes I think also its a must for this module. Looking forward to this feature.

littledynamo’s picture

Subscribe

littledynamo’s picture

I've written a patch, which allows different labels on each row. When the 'label' component is selected in the matrix component edit screen, there will be one textfield per row where the label can be added.

The module maintainer should probably review the following hunk in particular:

@@ -323,7 +333,10 @@ function theme_webform_matrix_table($variables) {
   $output = "<div class='form-item webform-component webform-component-matrix webform-component--$form_class webform-component-$form_class' id='$id'>";
   $output .=!empty($element['#matrix_header']) ? "<label>" . $element['#matrix_header'] . "</label>" : "";
   $output .= theme('table', array('header' => $headers, 'rows' => $rows, 'attributes' => array('id' => array("$id-table"))));
-  $output .= drupal_render_children($element);
+
+  // Render the 'add row' button.  Add row button id is in format add_row_formId.
+  $add_row_id = 'add_row_' . $element['#webform_component']['form_key'];
+  $output .= drupal_render_children($element, array($add_row_id));

I've made an assumption that the drupal_render_children($element) call is for the purpose of rendering the 'add row' button. Is this correct? The problem I had was that all labels were being rendered for a second time below the table, so I changed the drupal_render_children call to render ONLY the 'add row' button.

littledynamo’s picture

Status: Closed (works as designed) » Needs review

Status: Needs review » Needs work
littledynamo’s picture

Version: 7.x-4.0 » 7.x-4.x-dev
FileSize
5.85 KB

New patch. Removed d.o. packaging info, which was accidentally committed.

littledynamo’s picture

Status: Needs work » Needs review
chetan-singhal’s picture

Assigned: Unassigned » devd
littledynamo’s picture

Version: 7.x-4.x-dev » 7.x-3.x-dev
FileSize
7.27 KB

Backport to 3.x

steeph’s picture

The patch fails on the .info file. But it works, thanks!
I'm using 7.x-4.11.

devd’s picture

Thanks to all of you and Wish you very happy new year.

I will review your patches and requested functionality.

steeph’s picture

Any news on this? I'm using this on a webform that will go live soon. It works for me.

littledynamo’s picture

Version: 7.x-3.x-dev » 7.x-4.x-dev
devd’s picture

FileSize
20.65 KB
6.89 KB

Hi littledynamo,

Your patch is working as per you implementation but i have some issue.
Can you please fixed the following issue which are in the file addLevel2.png

littledynamo’s picture

@devendra.yadav Does that happen when clicking the 'Add row' button?

devd’s picture

Yes,

I think the following solution.
1- Your added label should not be mandatory.
2- Pick the Label of Header value when we are pressing the Add row button.
3- Put a Note in description regarding the same cause.

Thanks.
Devendra

littledynamo’s picture

littledynamo’s picture

Fresh patch. Added isset check to suppress a warning.

MrPeanut’s picture

The patch from #34 works great for me. Thanks, everyone!

sanderss77’s picture

Yes the patch #34 is working perfect. We really needed this patch! Thanks!

rparve@symphony3.com’s picture

Yes the patch #34 is working perfect. We really needed this patch! Thank you so much!

TLTHades’s picture

webform_matrix_component-7.x-4.x-dev. Patch #34. I get 10 warnings (to 10 rows of the matrix):
Notice: Undefined index: #type в функции theme_webform_matrix_table() (строка 397 в файле /sites/www/molbank/test.molbank.ru/sites/all/modules/webform_matrix_component/webform_matrix_component.module).

kruser’s picture

Patch #34 worked great for me

katannshaw’s picture

Patch #34 worked great at adding the labels for each row option for me as well (on 7.x-4.16)...thanks! However as noted from TLTHades on comment #38 I also received this warning once the patch was installed:
Notice: Undefined index: #type in theme_webform_matrix_table() (line 397 of sites\all\modules\webform_matrix_component\webform_matrix_component.module).

I see these warnings when clicking the Next/Previous button and they do match up with how many rows are in the matrix.

devd’s picture

Thanks littledynamo,

To develop this functionality. I review and verify the same functionality. it is working fine but getting some warnings when i click on button Add a row.

Notice: Undefined index: #type in theme_webform_matrix_table() (line 397 of /var/www/d7/sites/all/modules/contrib/webform_matrix_component/webform_matrix_component.module).
    Notice: Undefined index: #type in theme_webform_matrix_table() (line 397 of /var/www/d7/sites/all/modules/contrib/webform_matrix_component/webform_matrix_component.module).
    Notice: Undefined index: #type in theme_webform_matrix_table() (line 397 of /var/www/d7/sites/all/modules/contrib/webform_matrix_component/webform_matrix_component.module).

Please look that those.

snufkin’s picture

Updating the patch with code style fixes and added an additional check for the #type attribute. The warning/notice goes away on my local test.

  • littledynamo authored 8142f96 on 7.x-4.x
    Issue #2330505 by littledynamo, snufkin: Ability to Add Labels to each...
devd’s picture

Assigned: devd » Unassigned
Status: Needs review » Closed (fixed)

Fixed in dev version.

drattar’s picture

hi ...

patch #34 and patch #43 don't work with me.
i use Webform Matrix Component (7.x-4.17)
and i applied patch manually because my site is on shared server!

any idea?

drattar’s picture

hi

7.x-4.x-dev (2015-Sep-14 ) work correctly.