Re: [Zope] ZTUtils.Iterator value in ZPT

2005-07-20 Thread Chris Withers

David Pratt wrote:

div tal:define = tabindex python:Iterator(range(100));

div
.. html form contents
   .. a field
   input tal:attributes=tabindex/next ...
 ... another field   
/div


What are you actually trying to do here?

Would the following work?

div tal:define = tabindex python:range(1,101);
 div
 .. html form contents
.. a field
   input tal:attributes=tabindex ...
  ... another field
 /div

cheers,

Chris - who has no idea what a ZTUtils.Iterator is supposed to do...

--
Simplistix - Content Management, Zope  Python Consulting
   - http://www.simplistix.co.uk

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] ZTUtils.Iterator value in ZPT

2005-07-20 Thread David Pratt

Hi Chris. Thanks for your reply.

My understanding (which may be flawed) is that ZTUtils iterator 
provides values of a sequence as you iterate over them with a repeat 
statement.  I believe what I am trying to do is sensible.  I have 
looked at the api and can't seem to get the right magic using the 
methods  provided.  Tabindex for forms keeps track of tab position so 
when you use tab key it moves the cursor to next field tabindex in form 
.  So if I have 5 input fields from top to bottom, I want to define an 
iterator object, and obtain the next number in the iterator when zpt 
does its thing to create the form so that I would have a tabindex 
starting at 1 and next field value would be 2, then 3 etc.


A range by itself doesn't do the trick since it provides all values to 
the variable where I am looking only for a single number incremented to 
the next value.


Regards,
David


On Wednesday, July 20, 2005, at 03:51 AM, Chris Withers wrote:


David Pratt wrote:

div tal:define = tabindex python:Iterator(range(100));
div
.. html form contents
   .. a field
   input tal:attributes=tabindex/next ...
 ... another field   /div


What are you actually trying to do here?

Would the following work?

div tal:define = tabindex python:range(1,101);
 div
 .. html form contents
.. a field
   input tal:attributes=tabindex ...
  ... another field
 /div

cheers,

Chris - who has no idea what a ZTUtils.Iterator is supposed to do...

--
Simplistix - Content Management, Zope  Python Consulting
   - http://www.simplistix.co.uk


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] ZTUtils.Iterator value in ZPT

2005-07-19 Thread Peter Bengtsson
On 7/19/05, David Pratt [EMAIL PROTECTED] wrote:
 I want to intialize the value of ZTUtils.Iterator and use the value
 to increment tabindex attribute  in my ZPT for forms in CMF
 
 Something like:
 
 div tal:define iterator python:modules['ZTUtils'].Iterator; 
 div

Don't you need to create it with a sequence like
div tal:define iterator python:modules['ZTUtils'].Iterator(range(100)); 
-- 
Peter Bengtsson, 
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] ZTUtils.Iterator value in ZPT

2005-07-19 Thread David Pratt
Hi Peter. Thanks for your reply.  I think I am getting closer with this 
but still not quite right.
It appears I am calling Iterator right, because it gets an Iterator 
instance and now getting number 1

but that doesn't tell me much.


div tal:define = tabindex python:Iterator(range(100));

div
.. html form contents
   .. a field
   input tal:attributes=tabindex/next ...
 ... another field  
/div

is giving tabindex=1 all the way through my forms.  I thought next 
meant next, meaning you are asking the iterator for the next value. 
What am I missing?


Regards,
David

On Tuesday, July 19, 2005, at 07:18 PM, Peter Bengtsson wrote:


On 7/19/05, David Pratt [EMAIL PROTECTED] wrote:

I want to intialize the value of ZTUtils.Iterator and use the value
to increment tabindex attribute  in my ZPT for forms in CMF

Something like:

div tal:define iterator python:modules['ZTUtils'].Iterator; 
div


Don't you need to create it with a sequence like
div tal:define iterator 
python:modules['ZTUtils'].Iterator(range(100)); 

--
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )