1

I've got an embedded view (articles) in a webform with two child fields (article_title, article_body). I need to print/generate a PDF of the webform submission. The default template works, but looks messy in a table.

What is the right syntax to call the data from the child terms?

Here's my webform structure:

Here's my webform structure:

Using print ('<b>Report Name:</b> '.$renderable['report_name']['#value']); I can get the Report Name, but I can't seem to figure out how to get the the article_title and article_body fields. I'm not very familiar with coding and have been searching online for ages with no luck, except for this article which I can't seem to get working for my system either.

Any help would be appreciated.

Thanks

  • Try print_r($renderable) to see the structure of the data you're working with. – Rimu Atkinson Jul 31 '14 at 6:03
  • Below is one of the fields (article_title). But I still don't get what I should be using as it's key? Has it got anything to do with the fact that they're hidden in the form? But when using the default submission template, they come out fine. [4] => Array ( [nid] => 231 [cid] => 4 [pid] => 2 [form_key] => article_title [name] => Title [type] => hidden [value] => [node_title] [extra] => Array ( [hidden_type] => value [conditional_operator] => = [private] => 0 [conditional_component] => [conditional_values] => ) [mandatory] => 0 [weight] => 3 [page_num] => 1 ) – Milan Milosevic Jul 31 '14 at 6:21
  • Guessing this is the actual submission that has gone through: [#submission] => stdClass Object ( [sid] => 36 [nid] => 231 [submitted] => 1406779575 [remote_addr] => ::1 [uid] => 1 [name] => admin [is_draft] => 0 [data] => Array ( [1] => Array ( [value] => Array ( [0] => Milan 2 ) ) [2] => Array ( [value] => Array ( [0] => a:2:{i:212;a:3:{s:13:"article_title";s:38:"Takaful Ikhlas targets US$62.5 million";s:12:"article_body";s:668:" Takaful Ikhlas anticipates 50%... – Milan Milosevic Jul 31 '14 at 6:35
  • Yeah, maybe. It's hard for me to know, from this distance. You will find that using your browser's "View Source" feature will give you nicer formatting to read. .. – Rimu Atkinson Jul 31 '14 at 6:40
  • I think it's creating an array, which I don't know much about. I get the value of the textfield. And if I use the same code for the parent field '(print $renderable['articles']['#value']);' it just returns the word: Array. And when using the code for a child field it comes out empty and I get an error: Notice: Undefined index: article_title Thanx for your help though @RimuAtkinson – Milan Milosevic Jul 31 '14 at 6:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.