HI.

Is it possible to have a text field in the grid rather than a radio check box? I am thinking of something like # 9 in http://www.2ask.net/orbiz/DigiTrade/Table-Matrix--244n.html but not limited to two characters that a user can enter.

Thanks.

Comments

quicksketch’s picture

This currently isn't possible. The example you linked to is something entirely different from the current grid component. To get this functionality, you'd need to create a new component for Webform to use.

waynedrupal’s picture

Thank you for your response.

Is it possible, though, to change:
'#type'=> 'radios',

to

'#type'=> 'textfield',

and all instances of radios to text fields in grid.inc file without having to create a new component?

quicksketch’s picture

That might make the component show up in the form, but we'd need to rewrite the code for sending e-mail, CSV download, analysis, and summary information. I'm not sure it would save correctly either.

waynedrupal’s picture

So a new componant it is. I have placed a bounty on this as I need to have this functionality.

Is it possible, to also include both a text input as well as a drop-down select on the same component? For example:

One | Two | Three | Four

1. txt_field | txt_field | drop_down_select | txt_field

2. txt_field | txt_field | drop_down_select | txt_field

3. txt_field | txt_field | drop_down_select | txt_field

Where the drop_down_select would be four or five choices?

ambientdrup’s picture

I'm looking for this type of functionality/tweak to the Webform grid? Is anyone working on an enhancement currently? It would be great if we had a choice of data fields to use in the grid (radio buttons, checkboxes, text fields, etc).

-backdrifting

Mark B’s picture

StatusFileSize
new12.39 KB

I've written a new .inc file to support text fields in a grid layout. It supports either text or numeric data types, and you can choose the size of the text fields. It took a bit of jiggery-pokery to make the two-dimensional grid values save in a one-dimensional database format, but it works fine. The email, analysis and download elements have been updated too.

There are a few caveats:
1. data is stored in the database using indexes rather than keys, so any changes to the grid rows or columns will disrupt all previously submitted forms (although that's also the case in the regular grid component, which this is based on)
2. the analysis page just shows how many submissions had a value in each field in the grid - it doesn't break out the actual values
3. the validation on numeric fields doesn't highlight the invalid field - I can't the right field reference in form_set_error. If anyone can straighten that out I'm all ears

The biggest problem I have is that for some reason drupal.org will only let me attach jpg, jpeg, gif or png files, so I've had to rename the file to a jpg. To use this component, you'll have to rename the attached file to textgrid.inc and copy it into the components directory of your webform module.

This component was written and tested against Webform 5.x-2.2

brei9000’s picture

Mark B, this is exactly what I was looking for!!

I put the .inc file into my components folder... what do I do from there? I'm sorry for the newb question.

Thanks!!

Mark B’s picture

Oh yeah - I should probably have mentioned this in the earlier post!

Once the .inc file is in your components folder, you need to enable the textgrid component type in admin/settings/webform. You should then be able to add fields of that type to your forms.

z33k3r’s picture

The textgrid.inc does not work for me...

I can enable the plugin (which enables itself by default, btw) but when i enter the required fields, it returns divs without a containing div, labels, desc. text or formatting... Also, I don't believe that the field size should be a requirement...

<div class="form-item" id="edit-submitted-asd-Person-1-Age-wrapper">
  <input type="text" maxlength="128" name="submitted[asd][Person 1][Age]" id="edit-submitted-asd-Person-1-Age" size="15" value="" class="form-text" />
</div>
<div class="form-item" id="edit-submitted-asd-Person-1-Birth-Date-wrapper">
  <input type="text" maxlength="128" name="submitted[asd][Person 1][Birth Date]" id="edit-submitted-asd-Person-1-Birth-Date" size="15" value="" class="form-text" />
</div>
<div class="form-item" id="edit-submitted-asd-Person-1-Disabled?-wrapper">
  <input type="text" maxlength="128" name="submitted[asd][Person 1][Disabled?]" id="edit-submitted-asd-Person-1-Disabled?" size="15" value="" class="form-text" />
</div>
<div class="form-item" id="edit-submitted-asd-Person-2-Name-wrapper">
  <input type="text" maxlength="128" name="submitted[asd][Person 2][Name]" id="edit-submitted-asd-Person-2-Name" size="15" value="" class="form-text" />
</div>
<div class="form-item" id="edit-submitted-asd-Person-2-Age-wrapper">
  <input type="text" maxlength="128" name="submitted[asd][Person 2][Age]" id="edit-submitted-asd-Person-2-Age" size="15" value="" class="form-text" />
</div>
<div class="form-item" id="edit-submitted-asd-Person-2-Birth-Date-wrapper">
  <input type="text" maxlength="128" name="submitted[asd][Person 2][Birth Date]" id="edit-submitted-asd-Person-2-Birth-Date" size="15" value="" class="form-text" />
</div>
<div class="form-item" id="edit-submitted-asd-Person-2-Disabled?-wrapper">
  <input type="text" maxlength="128" name="submitted[asd][Person 2][Disabled?]" id="edit-submitted-asd-Person-2-Disabled?" size="15" value="" class="form-text" />
</div>
<div class="form-item" id="edit-submitted-asd-Person-3-Name-wrapper">
  <input type="text" maxlength="128" name="submitted[asd][Person 3][Name]" id="edit-submitted-asd-Person-3-Name" size="15" value="" class="form-text" />
</div>
<div class="form-item" id="edit-submitted-asd-Person-3-Age-wrapper">
  <input type="text" maxlength="128" name="submitted[asd][Person 3][Age]" id="edit-submitted-asd-Person-3-Age" size="15" value="" class="form-text" />
</div>
<div class="form-item" id="edit-submitted-asd-Person-3-Birth-Date-wrapper">
  <input type="text" maxlength="128" name="submitted[asd][Person 3][Birth Date]" id="edit-submitted-asd-Person-3-Birth-Date" size="15" value="" class="form-text" />
</div>
<div class="form-item" id="edit-submitted-asd-Person-3-Disabled?-wrapper">
  <input type="text" maxlength="128" name="submitted[asd][Person 3][Disabled?]" id="edit-submitted-asd-Person-3-Disabled?" size="15" value="" class="form-text" />
</div>
roball’s picture

Are there any plans to put such a functionality into a 6.x version?

quicksketch’s picture

No, not currently. I'm working on making the Drupal 6 3.0 version of Webform more pluggable so that other modules can provide their own fields. But right now this sort of functionality is not compatible with the way Webform stores data, which makes the task significantly more difficult.

vtemor’s picture

I am building a form that needs similar functionality to the component above, but for Webform 6.x-2.7. Has anyone coded this?

vtemor’s picture

Version: 5.x-2.0 » 6.x-2.7
Category: support » feature
barry_fisher’s picture

Did anyone find a solution for this? I'm also not getting labels rendered to the output. I'm looking into why not but thought I should ask before digging deep if the fix already exists. Thanks.

sol1313’s picture

Issue tags: +webform, +grid text input, +grid textinput, +text input grid webform
StatusFileSize
new13.81 KB

Hi,

I am really close to finding the solution. I used Mark B (thank you!) component and almost got it to work. If anyone wants to help me, maybe we can work it out together? There are several people looking for the same thing as I have seen on several different posts. I have figured out that the component above is not using the theme within the component which is why it is not displaying properly. I modified the code to call the theme of the radio button grid, and at least it is displaying correctly, but my labels are all gone. If anyone wants to tackle this together, please let me know. I would love to help create an add on to this module.

You can view an example here: http://soldesigns.net/ishopinusa/content/request-quote-0

I have attached what I have so far. I change to change the extension to .info since .inc are not allowed.

Thanks,
Sol

roball’s picture

I had a look at your test site, sol1313, which shows the warning

Invalid argument supplied for foreach() in /home/content/s/o/l/soldesigns/html/ishopinusa/modules/webform/components/grid.inc on line 387.

aaron stanush’s picture

+1 for this feature. I'm looking to build a webform for tracking sick/vacation time of employees (see attached mockup).

ezraw’s picture

+1

mohanprabu2’s picture

Me too looking for this component. Please refer me the component if exist..thanks.

scott m. sanders’s picture

Subscribing.

quicksketch’s picture

Version: 6.x-2.7 » 6.x-3.x-dev
Component: Miscellaneous » Code

Moving this to the 3.x version. Now that we have more robust data storage (see #712324: Convert Select and Grid Options to New Data Storage), this is at least now feasible. The database storage in 2.x makes even attempting this feature nearly impossible to accomplish.

stella’s picture

subscribe

geerlingguy’s picture

Would love this functionality. Subscribe :D

ellanylea’s picture

+1 subscribing

ShannonK’s picture

Subscribing.

Sinan Erdem’s picture

+1

AdamFx’s picture

subscribing.
This functionality would be great for a form I am developing. Interestingly googleApps Form doesn't offer this either.
For me I am looking for a grid to users to enter data over time
Columns month1, month2, month3, month4, month5, month6
Rows Q1, Q2, Q3, Q4, Q5, Q6

Any developments on this that are worth trying?

Thanks
AdamFx

quicksketch’s picture

No progress, since this is still a difficult problem to solve with our data architecture. It's been improved now, but no matter how you look at it this is a lot of data to store.

yesct’s picture

subscribing.

#28 says there have been improvements. Is that a reference to a patch in another issue?

I'm also wondering if we could "fake" a grid by storing each cell separately, as if it were a separate part of the form, but just *display* it in a grid.

Like if the columns are named: Mon Tues Weds
And the rows are: morning afternoon evening

Then the first cell could have a name for use in the db and on emails and results analysis pages like: Mon_morning, the second cell and so on would be: Tues_morning Weds_morning Mon_afternoon Tues_afternoon Weds_afternoon Mon_evening Tues_evening Weds_evening

Or some other naming rule...

But, I'm wondering if a solution for some of us is that the people entering the data want to see it as a grid, maybe other internal parts and people can just see a longer list of individual fields?

yesct’s picture

I dont know if http://drupal.org/project/arrange_fields might help in some situations.

yesct’s picture

Title: Possible for Grid to have text field? » Possible for Grid to have text field? A new testGrid component.

talked with quicksketch, will try and summarize.

thought a grid that allows text fields should be a separate new webform component type. not expanding grid, but maybe re-using some of the grid code. Maybe call the new component textgrid.

webform right now stores three keys
for every value. that being Component ID, Submission ID, and Key

problem:
"questions" (options along the left) and the "options"
(options along the top) of the table are BOTH keys, and then you need
to store user-entered value in the "value" column

so you'd need "key1" and "key2" in the database
but we only have one "key" column
fortunately there is a potentially easy solution of just mashing key1 and key2 together like "key1-key2" and putting it into the "key" column

there was a concern about would they ever need to be taken apart again. but, won't need to split
them apart, since that will be the the "name" attribute of the textfield too

How to represent this data in a CSV file? since it's a 3-dimensional grid, not a 2-d one. maybe it'd look like a multi-value select field without X's, instead with values in each one

webform will handle the storage in the database, but when editing a submission it's going to give you an
array of $values, which will be keyed like $values['q1o1'] = $user_text

like to do $form['q1']['o1'] as each textfield so you could loop through it easily when you theme it into a
table

----

I don't understand it yet, but hopefully can come to understand with some more dialog. I hope this helps others, or sparks an idea with someone.

ddyrr’s picture

I had started writing my own version of this before I saw this post. The way I did it was to remove the row labels, and replace it with the number of rows to show. I wanted something a little more like flexifield in cck, where I could have rows of the same questions, with the ability for the user to add additional rows. This is much easier to store in the db, since the data is the actual data being entered. The only problem is that you don't get row labels if you really want the grid style.

nicolash’s picture

subscribing

gwlangie’s picture

I am in the need for this functionality. Has any progress been made?

lefnire’s picture

subscribing

dgastudio’s picture

subscribe

fr34ck’s picture

subscribing

quicksketch’s picture

Status: Active » Postponed

I'm moving this to postponed. I have no intention of including this functionality directly in Webform core, but any module could add it through hook_webform_component_info(). When a 3rd-party solution becomes available, I will mark this issue as won't fix.

nicktech’s picture

subscribing

artatac’s picture

Sub

sourcesoft’s picture

subscribing, I need it here in this project. any idea when we gonna add this functionality?

jelle_s’s picture

subscribing

mario002e’s picture

subscribing

bkosborne’s picture

sub - i can see how difficult this is to implement. just want to track this thread to see any progree.

jelle_s’s picture

We needed this component too and managed to implement it for Drupal 6
see: Webfrom Table Element

truyenle’s picture

StatusFileSize
new49.42 KB

+subsribe.

I need to have this and I think it is popular for most application forms. See image.

Any clue, please help.

attiks’s picture

Have a look at http://www.drupal.org/project/webform_table_element, it can build a form like that

danchadwick’s picture

Issue summary: View changes
Status: Postponed » Closed (won't fix)
Issue tags: -

Closing for lack of activity and 6.x development. There is a matrix component for 7.x

quicksketch’s picture