[Zope] Dynamically generating fielsd in a form

D2 borelan@wanadoo.fr
Thu, 16 Jan 2003 13:36:11 -0400


Well, it's not a tree. The 'process' object is a model to follow to=20
dynamically generate fields to fill in in a form. When a step model is=20
'repeated' that means that the form will have to generate a field (a=20
clone of the step model) and then will have to look to the submit button=20
(validate) to generate a new clone, or (Newt Step) to read the next step=20
model. If a step is 'unique', the form will jump to the new step after=20
validation (the next step button).
I don't know if my question is clear. If not, i'll reformulate it.=20
(english is not my mother language but french is.)

I wanted to avoid learning Javascript as in the past weeks i began to=20
learn Python, Zope, Plone, CSS, HTML and so on? Pfff.
I supposed that JS might be necessary but...
Where can i find documentation on DHTML ?

I suppose context is relative to acquisition so i have to dive into=20
acquisition.

What suggestions would you make to a newbie to structure his learning of=20
Zope ? A method to learn. Note that by reading and crossing thousands of=20
pages i begin to have a precise global vision of the system but what i'd=20
like to do is to go back to the beginning and read again with my new=20
knowledge. But what is the beginning and what must be the steps to=20
follow to be on the way of having a deep and structured knowledge before=20
years of experience ;-)

And thanks for the job you do for the community

Andre

Dieter Maurer a =E9crit:
> aborel wrote at 2003-1-15 11:07 -0400:
>  > Some questions on tal:repeat.
>  >=20
>  > 1) Generating fields
>  >=20
>  > I have an object called 'process'
>  > this object contains a list of steps to follow to perform the proces=
s.
>  > A step have a type that may be 'unique' or 'repeated'
>  > 	For example : an invoice
>  > 	CustomerId : Unique step
>  > 	ProductId  : Repeated step (number of repetitions undefined)
>  > 			ProductId : 1 (sub-step)
>  > 			ProductId : 2 (sub-step)
>  > 			...
>  > 			ProductId : n (sub-step)(repeated until user 					chosees next st=
ep)
>  > 	NetDue     : Unique step
>  >=20
>  > What i want to do is to generate fields steps by step depending on t=
he
>  > type of the step by using tal:repeat to loop over the list of steps =
and
>  > display the rights fields.
>  > A 'unique' step will have one submit button : Next Step
>  > A 'repeated' step will have to submit buttons : Validate (to fill in=
 a
>  > new sub-step) and Next Step.
>  > Tal:repeat is useful on 'uniqu'e steps  but when i encounter a
>  > 'repeated' step, i can't use it as it's not a sequence and the numbe=
r of
>  > repetitions is undefined.
>  >=20
>  > Any Suggestions will be greatly appreciated.
> This is similar to a tree generation.
>=20
> Have a look at "ZTUtils.Tree" and the corresponding example
> (in the ZPT examples).
>=20
>  > 2) Validating fields
>  >=20
>  > Is it possible to use Python scripts instead of Ecma scripts on core
>  > events like onBlur, Onclick and so on ?
> No.
>=20
> You can use Python scripts for validation on the server side
> (after the form is submitted).
>=20
>  > 3) Displaying the fields
>  >=20
>  > Each time a field is filled in, i'd like to display it at the end of=
 a
>  > listing without re-redenring all the web page, just the changes
>  > (understandable ??? ;-)).
> You want to learn about DHTML (Dynamic HTML).
> You do this with JavaScript.
>  > ...
>  > 4) Storing the generated objects
>  >=20
>  > The form template will be called from various place on the site so h=
ow
>  > do i indicate the exact place to store the generated objects ?
> You use the form action like a method of the target object.
> If it is a Python Script (this is a good suggestion), then
> "context" is the target object. You can create the object
> at any place you can reach via "context".
>=20
>=20
> Dieter
>=20
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -=20
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>=20