Re: Dynamic form creation?

2008-01-27 Thread R. Rajesh Jeba Anbiah

On Jan 23, 3:20 pm, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote:
> Store fields name and type in db, and use $form->inputs( $arrayOfFields );
   

   As far as I have seen this, it's not that easy. Similar idea would
work with PEAR QuickForm, but cake's validations are tied up with
model and input field type creations are tied up with view helpers.

   So, for now, I'm thinking of writing a dynamic validation behavior
and another form helper inheriting core's form helper. Not still sure
that it gonna help.

--
  
Email: rrjanbiah-at-Y!comBlog:http://rajeshanbiah.blogspot.com/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Dynamic form creation?

2008-01-23 Thread Dardo Sordi Bogado

Store fields name and type in db, and use $form->inputs( $arrayOfFields );

On Jan 23, 2008 7:12 AM, R. Rajesh Jeba Anbiah
<[EMAIL PROTECTED]> wrote:
>
> On Jan 21, 2:10 pm, cakeFreak <[EMAIL PROTECTED]> wrote:
> > I did the following while working on a dynamic questionnaires
> > generation system.
>  
>
>  I think, you've misunderstood my question. This is not about
> multiple form inputs nor about DOM append.
>
>  Post RoR saga, many clients have shifted their interests from CMS
> to UIMS so that they can customize the UI especially forms. Majority
> of the requirement is to add/remove form fields by admin in signup
> page.
>
> --
>   
> Email: rrjanbiah-at-Y!comBlog:http://rajeshanbiah.blogspot.com/
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Dynamic form creation?

2008-01-23 Thread R. Rajesh Jeba Anbiah

On Jan 21, 2:10 pm, cakeFreak <[EMAIL PROTECTED]> wrote:
> I did the following while working on a dynamic questionnaires
> generation system.
 

 I think, you've misunderstood my question. This is not about
multiple form inputs nor about DOM append.

 Post RoR saga, many clients have shifted their interests from CMS
to UIMS so that they can customize the UI especially forms. Majority
of the requirement is to add/remove form fields by admin in signup
page.

--
  
Email: rrjanbiah-at-Y!comBlog:http://rajeshanbiah.blogspot.com/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Dynamic form creation?

2008-01-21 Thread cakeFreak

I did the following while working on a dynamic questionnaires
generation system.

1 Questionnaire hasMany Questions
1 Question has Many options (for multiple answers)

---
ANSWERS
--
1 Questionnaire hasMany AnswersMain
1 AnswerMain hasMany Answers

AnswerMain has:
- id
- questionnaire_id
- user_id

Answers has:
- id
- answermain_id
- question_id
- user_id

To create the questionnaire I used Javascript (jQuery) to dynamically
generate the several options fields for a question

Dan
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Dynamic form creation?

2008-01-21 Thread cakeFreak

I did the following while working on a dynamic questionnaires
generation system.

1 Questionnaire hasMany Questions
1 Question has Many options (for multiple answers)

---
ANSWERS
--
1 Questionnaire hasMany AnswersMain
1 AnswerMain hasMany Answers

AnswerMain has:
- id
- questionnaire_id
- user_id

Answers has:
- id
- answermain_id
- question_id
- user_id

To create the questionnaire I used Javascript (jQuery) to dynamically
generate the several options fields for a question

Dan
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Dynamic form creation?

2008-01-20 Thread R. Rajesh Jeba Anbiah

On Jan 20, 8:10 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
   
> I decomposed each form element in "form element" linked to a model and
> a controller (for example, all forms have a similar
> "client_identification" part that is linked to the client controller
> and model). Another example is a "donation_info" form element that is
> linked to the donation model and controller. So it's a not a fully
> customizable dynamic form creator, the form must be "assembled" out of
> pre defined elements and they can also add some custom fields.
   

   Many thanks for sharing your ideas. Before starting this thread, I
had 2 ideas:
1. Create model files and DB tables dynamically
2. Keep the form configurations in a DB table and handle them

   I felt that both of the approaches are inefficient/unintelligent
and so posted this question. After googling a lot, I just seem to get
some solutions/works in Django (still not sure) and I'm yet to look at
those closely to see if they're efficient.

   Thanks again for sharing the ideas.

--
  
Email: rrjanbiah-at-Y!comBlog:http://rajeshanbiah.blogspot.com/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Dynamic form creation?

2008-01-20 Thread [EMAIL PROTECTED]

I'm currently working on an "in between" solution. It's for a big
hospital foundation. They need different forms for online donations,
subscription to activities, other requests, etc.  They supplied me
about 10 different examples of form they would like to be able to
customize.

I decomposed each form element in "form element" linked to a model and
a controller (for example, all forms have a similar
"client_identification" part that is linked to the client controller
and model). Another example is a "donation_info" form element that is
linked to the donation model and controller. So it's a not a fully
customizable dynamic form creator, the form must be "assembled" out of
pre defined elements and they can also add some custom fields.

I created a module that let the managers create new forms out of the
element, another one to assemble and display the form to the end user.
I found a way (using session variable) to save the data in multiple
model and keep the validation information for each. I'm currently
working on a simple workflow module that will let the manager define
the role of their employees and the "routing" for each type of form.

If I was working on a "survey creator", I would use the same strategy,
with a "form element" for each type of questions and the content of
the question as  parameters.

For a fully customizable dynamic form system, allowing the users to
create their models would be a solution, the only problem I see is how
to store that data afterward. Do you want to create a different table
for each user defined form ? Otherwise, you would need to bypass the
model -> database and create a novel way to take the form data based
on that model and save it in a different way.



On Jan 20, 6:57 am, "R. Rajesh Jeba Anbiah"
<[EMAIL PROTECTED]> wrote:
> On Jan 20, 9:13 am, Baz <[EMAIL PROTECTED]> wrote:
>
> > I guess I'm misunderstanding also, but what was the problem with
> > $form->inputs()?
>
> > If your using that database, that means model. $form->inputs() dumps inputs
> > for all the form fields.
>
>    The situation is more of like allowing the users to create models;
> the users define fields, rules/validations, labels, etc
>
> --
>   
> Email: rrjanbiah-at-Y!com    Blog:http://rajeshanbiah.blogspot.com/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Dynamic form creation?

2008-01-20 Thread R. Rajesh Jeba Anbiah

On Jan 20, 9:13 am, Baz <[EMAIL PROTECTED]> wrote:
> I guess I'm misunderstanding also, but what was the problem with
> $form->inputs()?
>
> If your using that database, that means model. $form->inputs() dumps inputs
> for all the form fields.

   The situation is more of like allowing the users to create models;
the users define fields, rules/validations, labels, etc

--
  
Email: rrjanbiah-at-Y!comBlog: http://rajeshanbiah.blogspot.com/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Dynamic form creation?

2008-01-19 Thread Baz
I guess I'm misunderstanding also, but what was the problem with
$form->inputs()?

If your using that database, that means model. $form->inputs() dumps inputs
for all the form fields.
--
Kevin Lloyd
3HN Designs
http://www.3HNDesigns.com/
(214) 473-4207

On Jan 19, 2008 3:39 PM, R. Rajesh Jeba Anbiah <[EMAIL PROTECTED]>
wrote:

>
> On Jan 20, 12:30 am, "Chris Hartjes" <[EMAIL PROTECTED]> wrote:
> > On Jan 19, 2008 1:01 PM, R.RajeshJebaAnbiah
> >
> > <[EMAIL PROTECTED]> wrote:
> > >I'm not sure, if you have understand my question. RoR based
> > > frameworks allow easy creation/use of form when DB table is created.
> > > But, I'm looking for a solution to create forms dynamically--something
> > > as in LimeSurvey.
> >
> > I *think* I may have run into what you're talking about here.  I'm
> > building a section of a web site for voting on things (the simulation
> > baseball league I am in has a vote during the off-season for changing
> > league rules and rules for the game we use), and there can be any
> > number of items on the ballot.
> >
> > So, while googling around looking for some help on this I found that
> > you can use the following notation to create multiple instances of the
> > same field:
> >
> > $form->input("{$x}.Model.field")
>
>
>Multiple form inputs is one way of handling dynamic forms. But, I
> was looking for more control--dynamic validations, etc. Since, the
> user data are tied up closely with DB tables and models in RoR based
> frameworks, I was thinking/looking for a generic and better approach
> to handle it.
>
>Thanks for the suggestion anyway.
>
> --
>  
> Email: rrjanbiah-at-Y!comBlog: http://rajeshanbiah.blogspot.com/
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Dynamic form creation?

2008-01-19 Thread R. Rajesh Jeba Anbiah

On Jan 20, 12:30 am, "Chris Hartjes" <[EMAIL PROTECTED]> wrote:
> On Jan 19, 2008 1:01 PM, R.RajeshJebaAnbiah
>
> <[EMAIL PROTECTED]> wrote:
> >I'm not sure, if you have understand my question. RoR based
> > frameworks allow easy creation/use of form when DB table is created.
> > But, I'm looking for a solution to create forms dynamically--something
> > as in LimeSurvey.
>
> I *think* I may have run into what you're talking about here.  I'm
> building a section of a web site for voting on things (the simulation
> baseball league I am in has a vote during the off-season for changing
> league rules and rules for the game we use), and there can be any
> number of items on the ballot.
>
> So, while googling around looking for some help on this I found that
> you can use the following notation to create multiple instances of the
> same field:
>
> $form->input("{$x}.Model.field")


Multiple form inputs is one way of handling dynamic forms. But, I
was looking for more control--dynamic validations, etc. Since, the
user data are tied up closely with DB tables and models in RoR based
frameworks, I was thinking/looking for a generic and better approach
to handle it.

Thanks for the suggestion anyway.

--
  
Email: rrjanbiah-at-Y!comBlog: http://rajeshanbiah.blogspot.com/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Dynamic form creation?

2008-01-19 Thread Chris Hartjes

On Jan 19, 2008 1:01 PM, R. Rajesh Jeba Anbiah
<[EMAIL PROTECTED]> wrote:
>I'm not sure, if you have understand my question. RoR based
> frameworks allow easy creation/use of form when DB table is created.
> But, I'm looking for a solution to create forms dynamically--something
> as in LimeSurvey.

I *think* I may have run into what you're talking about here.  I'm
building a section of a web site for voting on things (the simulation
baseball league I am in has a vote during the off-season for changing
league rules and rules for the game we use), and there can be any
number of items on the ballot.

So, while googling around looking for some help on this I found that
you can use the following notation to create multiple instances of the
same field:

$form->input("{$x}.Model.field")

In my case, I loop through each item in the ballot and present a radio
button to allow me to vote on it.

 1, 'No' => 0, 'Abstain' => 2);

foreach ($ballotItems as $ballotItem) {
echo $form->radio("{$x}.Vote.answer", $answerOptions)
$x++;
}

?>

Then, when you submit the form to be processed, you should see
something like this in $this->data

$this->data[1]['Vote']['answer'] = ...
$this->data[2]['Vote']['answer'] = ...

Hope that helps.

-- 
Chris Hartjes
Internet Loudmouth
Motto for 2008: "Moving from herding elephants to handling snakes..."
@TheKeyBoard: http://www.littlehart.net/atthekeyboard

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Dynamic form creation?

2008-01-19 Thread R. Rajesh Jeba Anbiah

On Jan 19, 9:55 pm, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote:
> have you checked the FormHelper::inputs() method?

   I'm not sure, if you have understand my question. RoR based
frameworks allow easy creation/use of form when DB table is created.
But, I'm looking for a solution to create forms dynamically--something
as in LimeSurvey.

--
  
Email: rrjanbiah-at-Y!comBlog: http://rajeshanbiah.blogspot.com/

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Dynamic form creation?

2008-01-19 Thread Dardo Sordi Bogado

have you checked the FormHelper::inputs() method?

On Jan 18, 2008 1:04 PM, R. Rajesh Jeba Anbiah
<[EMAIL PROTECTED]> wrote:
>
> Has anyone tried to implement dynamic form creation? I'm looking for a
> solution to implement dynamic form creations.
>
> --
>   
> Email: rrjanbiah-at-Y!comBlog: http://rajeshanbiah.blogspot.com/
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Dynamic form creation?

2008-01-18 Thread R. Rajesh Jeba Anbiah

Has anyone tried to implement dynamic form creation? I'm looking for a
solution to implement dynamic form creations.

--
  
Email: rrjanbiah-at-Y!comBlog: http://rajeshanbiah.blogspot.com/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---