When I submit my webform it only saves the YoName text field that precedes the Table Element. All the (5) checkboxes that I've selected aren't stored.
Am I trying to do something impossible? Hopefully, I'm missing something obvious. I think it would be cool to do school lunch menus with Webform/Table Element.
(attached: view; webform and submission).
Using a basic D7 install - Webform / Webform Table Elements. No errors/notices of any kind in reports/log.
Any ideas on what I can do to try and make this work? I found http://drupal.org/node/1259022 - but am assuming this is perhaps different - as the current 7.x-1.6 is >6mo newer than then the 7.x-1.x-dev in that post - and I'm seeing something like that.
Thanks,
Comment | File | Size | Author |
---|---|---|---|
#35 | tableelements.png | 5.75 KB | KarinG |
#33 | webformtable.png | 26.92 KB | KarinG |
#25 | test_table_element.jpg | 210.31 KB | Milado |
#25 | 1-1.jpg | 25.79 KB | Milado |
#25 | 1-2.jpg | 194.91 KB | Milado |
Comments
Comment #1
KarinGI've gotten a little further with this. It's the checkboxes that are causing the troubles. So I've edited the title a bit.
1. When I put radio buttons within a Table Element: image attached: wradiobuttons.png
I can submit the form and all is well - all data are stored.
2. NEXT, in Option settings for desert checking the box Multiple (values will let users select multiple items in this list) - so the form now looks like:
with Checkboxes: image attached: wcheckboxes.png
Upon submit produces these warnings (below) and does NOT store the data [sorry didn't see warnings before - had switched them off in preparation for a demo]. All I see in my submission Email (or Results) is the selections for the Size (which are still radio buttons) and a heading Desert -> but NO values for it.
Comment #2
KarinGI worked on this some more and found that when I clone the "Size" element from #1 -> (gave it a new field key) -> an dragged it outside the Table Element -> data for that element outside of the Table Element are stored as expected.
I also just looked at Webform Commerce -> as presumably these school lunches are going to be paid for. Similar thing: if I have the SKU element outside of the Table Element all is well. If I place the SKU element within a Table Element - I get notices/warnings and the data that are collected there are not stored.
Staring to perhaps look like some elements can be placed within a Table Element - and some can not (yet)? I'm willing to put some time into this. But if you think I'm on the wrong track (and checkboxes/SKUs should work as is) then please let me know.
Thanks,
Comment #3
KarinGComment #4
ownage CreditAttribution: ownage commentedYour webform screenshots are confusing me. Here's what I did to try to replicate this:
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1_creating_table_element.png
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2_creating_checkbox_1.png
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3_creating_checkbox_2.png
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
4_test1.png
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
5_test2.png
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
The behavior in the results wasn't what I had expected, (as it doesn't show what people have checked), but because we only have one option per row, we are still able to see what is checked by seeing the row label.
This should probably be fixed to show what people have checked.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
KarinG: Your issue is different than mine-- I went about creating my select list differently. I actually don't know how you made your list if your screenshots are in sync with each other. Perhaps that is why you are getting warnings? (I didn't get any the way I made mine). Your issue actually looks like what I encountered (blank nothingness - in my case - caused by the field keys being identical). I would double check your field keys on everything & every option to make sure each are unique.
Comment #5
Milado CreditAttribution: Milado commentedI've the same problem. I discovered Webform Table Element this morning and I need to make a grid where you can choose multiples values per lines, so I need to use checkbox instead of radio buttons.
First of all I also had the " Warning: htmlspecialchars() expects parameter 1 to be string ..." error.
I did exactly the same things as you ownage.
I realize that I don't have the error anymore if I don't check the "Multiple : Multiple values will let users select multiple items in this list." option, BUT submission is still not saved! (and I think you checked it because there is no way to have a chekbox button without it).
Please help !
Comment #6
KarinGThanks for this!
I tried to reproduce your Select Test. Figuring that would be a good start to figure out why checkbox data isn't stored.
Details:
1. grabbed the latest dev for Table Element (7.x-1.6+2-dev) [based on your other post - you're working w/ the -dev, corrrect?]
2. disabled "Options Element", "Multicolumn checkboxes radios" and "Select (or Other)" modules to ensure absolutely nothing is running interference
3. checked version for Webform:7.x-3.18
Screenshots:
1. collage: my select_test.png: view / webform and the three components of the webform
The only difference I can see - is that I have a "Multiple" option -> I've marked it with a red square. If I leave it unchecked -> I get a radio button. If I check it I get a checkbox instead of a radio button. What version of Webform are you using?
2. results: select_test_results: before and after I hit Submit. I'm getting a notice and it's not saving any result (staying on the view screen). The field keys are different so the notice isn't the result of that [wish it was - then mystery solved].
This is starting to drive me bananas - but then I enjoy a good puzzle. Did I miss anything recreating your Select Test?
Comment #7
Milado CreditAttribution: Milado commentedI made a mistake in the previous post I'm on the 7.x-1.6 version (but it's strange to have the same bug as you during the same period...)
Comment #8
ownage CreditAttribution: ownage commentedAttiks changed my issue to a Dev. project: http://drupal.org/node/1662708#comment-6168542
So when I tested mine, I was using the recommended release (7.x-1.6) and still am.
Thanks for the attachments, this really is the only way for the developers to pinpoint problems so I'm sure they will appreciate our inputs.
Comment #9
KarinGOk, I ended up with plan B - should have likely been plan A from the start - since all I'm trying to do is to make a table with checkboxes. I've ditched Webform Table Element - it's just having too much difficulty to store data - even for very simple webform nodes.
plan B involved taking the webform-form.tpl.php that is supplied with Webform module and copying that into the theme you're using to render the webform page. If you're using a system default theme - then first create a proper sub theme - then apply that as your default theme to render the webform. Rename the tpl file to webform-form-[nid].tpl.php if you only want to style one of your webforms. You must clear your caches before Drupal will know that you now have a custom tpl to render your webform.
In the tpl you can place all elements of $form anywhere you want. I've put them in table th td and tr to create my grid of productfield (Commerce Webform) checkboxes. Many themes already have default colouring of rows, so simply apply classes (e.g. in a seven-based sub theme: class="odd" and class="even") to quickly make a very nice looking table.
Devel and Theme Developer module in particular are very handy modules to inspect the $form - so that you can figure out what to put where in your table.
Comment #10
attiks CreditAttribution: attiks commented@all:
Thanks for the extensive debugging, this makes it easier for us to debug.
I just committed a possible fix to the latest dev version, this needs testing!!!
#9: this is a good work-around, we used to do this in the past as well, but the problem is that an end user cannot do this, hence this module.
Comment #11
Milado CreditAttribution: Milado commentedHi KarinG, could you please show us what do you make into your webform-form.tpl.php ?
I'm also looking for another way to display a table with checkboxes , but in this file you only have a call to drupal_render and drupal_render_children so I don't understand how you modify the render.
Comment #12
attiks CreditAttribution: attiks commentedComment #13
Milado CreditAttribution: Milado commented@attiks : thank you for working on this, I've download the dev version and your commit to try to fix it. But it doesn't seem to work for me :
Comment #14
attiks CreditAttribution: attiks commentedPushed a new fix for the warnings, can you post a screenshot from the results
Comment #15
Milado CreditAttribution: Milado commentedThanks but it's still not working.
Here is a result screen, do not pay attention to the first and second errors they are here since the installation of this DrupalTest, it's a small configuration problem.
Comment #16
attiks CreditAttribution: attiks commentedCan you add the following into bootstrap.inc, replacing the original function
Comment #17
attiks CreditAttribution: attiks commentedWarnings should be solved, keep in mind that you need at least another component on the form (maybe a hidden one) otherwise the form will not submit.
Comment #18
KarinG@Milado - I'd be happy to.
$form is an array that contains everything there is to know about the form.
Make sure you disable the rendering of $form['submitted'] as they can only be rendered once
<!-- <?php //print drupal_render($form['submitted']); ?>-->
Then underneath that - start with something like:
<?php print_r($form['submitted']); ?>
Reload your webform node and you'll start to get a good idea of what's all in the array that you can grab and theme.
I'll share what I have at the moment. It's producing (attached).
Comment #19
Milado CreditAttribution: Milado commented@KarinG > Well thank you understand know, you still use drupal_render but you use it many times, so you can make the form looks like an array, good job ;)
@attiks > Sory to disappoint you but I still have the warning!
BUT data are saved (with another component, sorry I didn't knew that).
I've now the same view as ownage :
So the display of boxes cheked is not working but with dpm we can see that data are corectly stored :
Like I said before I installed the -dev version this morning and then aply your commits, is that the correct process to do? (I'm new to the drupal community so I may have made a mistake)
Comment #20
KarinG@Milado - you're welcome. Let me know if you need more details. Many more .tpl.php files come w/ Webform module so you can do the same with the other screens, like View Submission. For someone new to Drupal you're doing just fine.
@attiks - thanks for paying attention to this issue now - you had 3 people reporting they can't save checkbox data :-) It will be indeed be very useful for many to be able to do this from the Webform GUI. I hope you can get this to work properly.
Comment #21
attiks CreditAttribution: attiks commentedThe easiest is to use git:
git clone --recursive --branch 7.x-1.x http://git.drupal.org/project/webform_table_element.git
so you can dogit pull
to update to the latest version.Display for switched rows isn't working, I'll have a look at it.
Comment #22
Milado CreditAttribution: Milado commentedYou're right there is no warning if I disabled the switch functionality! Hope you can fix it.
I've found another small bug (I should maybe make another post, but I prefer to warn you so you may be aware of it) :
If you create a checkboxe with multiples elements (so a table of checkboxes with more than one boxe on each case), only the first element checked will be displayed on the "view" page!
And there is the screen :
Comment #23
attiks CreditAttribution: attiks commentedOutput should be fixed for both options: regular and row/cols switched
In the case of 'row/cols switched' the data needs to be resaved otherwise it can show up in the wrong order!
Comment #24
attiks CreditAttribution: attiks commentedsecond screenshot should be
Comment #25
Milado CreditAttribution: Milado commentedThank you for this work! So yes I see corectly the result table for both options... but there are many notices/warnings for both cases!
For the test made at #22
And for another webform made with column/row switched I've another kind of warnings :
-----------------
I'll have a look concerning Git but for now I'm still wondering if I should be on the recommended or development release ?
Comment #26
attiks CreditAttribution: attiks commentedIf you want to switch rows and columns you better use the dev version, I'll work on the warnings later today.
Does this mean that everything is working now, except for the warnings?
Comment #27
Milado CreditAttribution: Milado commentedOk so I'll stay on this version. Yes it does!
Comment #28
attiks CreditAttribution: attiks commentedWarnings fixed.
Comment #29
Milado CreditAttribution: Milado commentedProblem solved, it looks like everything is working fine.
Once again thank you attiks for all the job done!
Comment #30
KarinG@attiks - would you like me to test this w/ productfield checkboxes?
Comment #31
attiks CreditAttribution: attiks commented@KarinG feel free to test, the more the better, but just so you know I created a 1.7 version a minute ago.
Comment #32
KarinGOk, will do.
Comment #33
KarinGSorry - still not working at all with a table of productfield checkboxes. The form doesn't even get submitted.
I can recreate the table I posted in #18: lunchtpl.png.
Getting plenty of Notices (30x2) - so 4 Notices per checkbox
Critical is that absolutely nothing happens upon form submission (Add to cart) . So there are no troubles rendering the view table node - but that's all it really does here. I'll need to continue to theme my own table using the tpl.php files.
Comment #34
attiks CreditAttribution: attiks commentedyou need to add at least one regular component, it might be a hidden one, otherwise the post isn't working, the reason is that webform does not know about our post variables.
the example above is using regular checkboxes or some other component?
Comment #35
KarinGYes - of course - I knew about the POST - ok, I've added a Name field - I can now hit Add to cart to get to a next screen - but I can't get it to store info for the checkboxes (and it doesn't get into the shopping cart). I'm using productfield checkboxes - by Webform Commerce module. So no - they are not ordinary checkboxes. Still if you can render the view node properly - there should be a way to store the data that are entered - regardless of what field originally created the element, not?
Comment #36
attiks CreditAttribution: attiks commentedmodule: commerce_webform
The problem is that the submit function isn't called, since webform has no knowledge about the post data and cannot call the standard submit function as defined by commerce_webform. The same goes for the displaying of the values in the results.
Turning this into a feature request, to support this we need custom handling inside:
Comment #37
hazmoid CreditAttribution: hazmoid commentedOk so I built a safety form based on radio buttons and text fields. I had each row of the webform Table defined as a separate item and added the radio buttons and textfield and was getting a form that looked like what I wanted. Only problem is that it did not output the the radio button setting, and it also would not output the text in the textfield. This was annoying since I spent an afternoon getting the form to look right :( I was getting an undefined index error for every field in each of the tables as well. I made a point of changing the machine field name in each table because they had the same titles for each of the radio and textfields.
At this point I have wiped all the tables out and am looking for an option that will give me the output I need. I originally started out with the idea of making each field a conditional display of the textfield but this did not give me the nice table layout.
Getting very frustrated now.
Comment #38
attiks CreditAttribution: attiks commentedSad to hear you're running into problems, but without any concrete information it will be hard to help you. A screenshot of your webform components as well as the rendered webform might help.
If you're using 'productfield checkboxes - by Webform Commerce module', then this isn't going to work right now, feel free to write a patch or find funding to implement this.
Comment #39
travist CreditAttribution: travist commentedMost of these issues should be fixed in the 2.x version of the module. Be warned, though, there is currently not an upgrade path to 2.x, so only upgrade if your site is a new implementation.