PEAR Forum :: PHP Extension and Application Repository

PEAR Forum Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
QuickForm recursive group and subgroup elements

 
Post new topic   Reply to topic    PEAR Forum Forum Index -> HTML
View previous topic :: View next topic  
Author Message
MrLight



Joined: 10 Mar 2008
Posts: 6

PostPosted: Mon Mar 10, 2008 9:50 pm    Post subject: QuickForm recursive group and subgroup elements Reply with quote

Hi Forum (my first post here, please forgive me my poor english Smile!

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", "&nbsp;\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", "&nbsp;\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 Smile


Last edited by MrLight on Tue Mar 11, 2008 2:01 pm; edited 1 time in total
Back to top
View user's profile Send private message
mark



Joined: 07 Jan 2007
Posts: 1011

PostPosted: Mon Mar 10, 2008 11:15 pm    Post subject: Reply with quote

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
View user's profile Send private message
MrLight



Joined: 10 Mar 2008
Posts: 6

PostPosted: Tue Mar 11, 2008 12:08 pm    Post subject: Subform? Reply with quote

Hi,

Do You talk abaut that?

Mr Light Smile
Back to top
View user's profile Send private message
MrLight



Joined: 10 Mar 2008
Posts: 6

PostPosted: Tue Mar 11, 2008 2:24 pm    Post subject: WOW I have the form :-) nut now validating doesnt function: Reply with quote

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 ... Sad


Mr Light Smile
Back to top
View user's profile Send private message
MrLight



Joined: 10 Mar 2008
Posts: 6

PostPosted: Tue Mar 11, 2008 2:56 pm    Post subject: Reply with quote

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 Smile
Back to top
View user's profile Send private message
mark



Joined: 07 Jan 2007
Posts: 1011

PostPosted: Tue Mar 11, 2008 3:33 pm    Post subject: Re: Subform? Reply with quote

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
View user's profile Send private message
MrLight



Joined: 10 Mar 2008
Posts: 6

PostPosted: Tue Mar 11, 2008 4:15 pm    Post subject: Hi mark :-) Reply with quote

// 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 Smile
ps: You can contact me in ICQ, to finish this Diskuss, I would like ... Smile

// off-Topic end
Back to top
View user's profile Send private message
MrLight



Joined: 10 Mar 2008
Posts: 6

PostPosted: Tue Mar 11, 2008 6:19 pm    Post subject: First Result! Reply with quote

OK, I have a workaround.

You can see it here.

When I have time, I will make a nicer solution.

Mr Light Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    PEAR Forum Forum Index -> HTML All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



PEAR Forum topic RSS feed 
Powered by phpBB © 2001, 2005 phpBB Group

Provided by Ministry of Web developement

'Actiemonitor' online projectmanagement software