| View previous topic :: View next topic |
| Author |
Message |
MrLight

Joined: 10 Mar 2008 Posts: 6
|
Posted: Mon Mar 10, 2008 9:50 pm Post subject: QuickForm recursive group and subgroup elements |
|
|
Hi Forum (my first post here, please forgive me my poor english !
I am playing around with QuickForm and groups. So I have a Array, which have normal Elements and subarrays. This I want to put in a form, so that I can edit them simply.
My problem is, that the array have different deep steps, array in array in array, and so on.
So I try to made a reqursive way to build the form. First I build a (very) big array, which I want at the end to add to my Form. But it doesnt function. The Error, what I got is (tail -f /var/log/httpd/error_log):
| Code: | | PHP Fatal error: Call to a member function on a non-object in /usr/share/pear/HTML/QuickForm/group.php on line 409 |
Here You can see the Code, and all the other stuff (I didn't post it here, not to make the post to long):
Reqursiv_Array_E.php
I commented the line out, which makes the Problem.
| Code: | //--- HERE is the error (Adding the builded Group to empty Form: ---
$form->addGroup($group, null, "USER", " \n<br/>\n");
//-----------------------------------
|
The strange thing is, that, if I try to add only a subpart like that:
| Code: | <?PHP
$form->addGroup($group["[user][firm]"]["[user][firm][slogan_2]"], null, "USER", " \n<br/>\n");
?> |
it function propper.
Here the Example:
Reqursiv_Array_E2.php
For some helpfull Infos for a beginner, I would be thankfull.
Mr Light 
Last edited by MrLight on Tue Mar 11, 2008 2:01 pm; edited 1 time in total |
|
| Back to top |
|
 |
mark

Joined: 07 Jan 2007 Posts: 1051
|
Posted: Mon Mar 10, 2008 11:15 pm Post subject: |
|
|
Your idea doesn't work with QF, as it supports only one array level for groups.
Somewhere in the internet there is a "subform" element for QF that might help you to realize your idea. An alternative would be the ElementGrid package: http://pear.php.net/package/HTML_QuickForm_ElementGrid |
|
| Back to top |
|
 |
MrLight

Joined: 10 Mar 2008 Posts: 6
|
Posted: Tue Mar 11, 2008 12:08 pm Post subject: Subform? |
|
|
Hi,
Do You talk abaut that?
Mr Light  |
|
| Back to top |
|
 |
MrLight

Joined: 10 Mar 2008 Posts: 6
|
Posted: Tue Mar 11, 2008 2:24 pm Post subject: WOW I have the form :-) nut now validating doesnt function: |
|
|
Hi Hier first the new Result.
But when I klick on Submitt, the values will not be validatet!
What Do I wrong? everything looks nice ...
Mr Light  |
|
| Back to top |
|
 |
MrLight

Joined: 10 Mar 2008 Posts: 6
|
Posted: Tue Mar 11, 2008 2:56 pm Post subject: |
|
|
I see that the squared brackets "[]"make the problem. When I change them to normal brackets "()" it function good. I have now only to found how to transfaire the Values back to my array... here the result.
Mr Light  |
|
| Back to top |
|
 |
mark

Joined: 07 Jan 2007 Posts: 1051
|
Posted: Tue Mar 11, 2008 3:33 pm Post subject: Re: Subform? |
|
|
| MrLight wrote: | | Do You talk abaut that? |
Yes. (Please keep your questions in *one* forum. I'll take a look on your post in the German forum [we both have the same nickname there] later.) |
|
| Back to top |
|
 |
MrLight

Joined: 10 Mar 2008 Posts: 6
|
Posted: Tue Mar 11, 2008 4:15 pm Post subject: Hi mark :-) |
|
|
// off-Topic
when I post in two different forums about same problem, then I keep an eye on both and cross post the solutions. I know, that is not liked by everyone, but the point is simply. Not every one from english forum read the german or franch or japanise forum, and oposit. So if I found a solution in an english forum, I fix it, and post the soution in both some times three forums. So if someone searh he / she can found a solution in his language. That makes the live easyer, and support sometimes small forums to get more populer...
Mr Light
ps: You can contact me in ICQ, to finish this Diskuss, I would like ...
// off-Topic end |
|
| Back to top |
|
 |
MrLight

Joined: 10 Mar 2008 Posts: 6
|
Posted: Tue Mar 11, 2008 6:19 pm Post subject: First Result! |
|
|
OK, I have a workaround.
You can see it here.
When I have time, I will make a nicer solution.
Mr Light  |
|
| Back to top |
|
 |
|