Loading ...
Sorry, an error occurred while loading the content.

4767Re: [Cheetahtemplate-discuss] Create html buttons dynamically

Expand Messages
  • tyler@monkeypox.org
    Dec 2, 2009
    • 0 Attachment
      On Wed, 02 Dec 2009, V?ry D?niel wrote:

      > Hi all,
      >
      > I was searching the archive but couldn't find the answer to my question:
      >
      > I'd like to create Buttons in my html form dynamically. I have a list variable, which has the button names, and I'd like to create the buttons based on that. The amount of the list items would give the amount of buttons to create, and the name of the list items would be the names of the buttons. I assume that a for-loop would be the best shot, but I'm not sure about the syntax.
      >
      > Any help would be greatly appreciated,

      Yeah, a #for loop is likely you're best candidate:

      #for name in $buttons
      <input type="button" name="$name" value="$name"/>
      #end for

      That will cause those buttons to be output inline in the template where the
      forloop is.



      Cheers,
      -R. Tyler Ballance
      --------------------------------------
      Jabber: rtyler@...
      GitHub: http://github.com/rtyler
      Twitter: http://twitter.com/agentdero
      Blog: http://unethicalblogger.com
    • Show all 2 messages in this topic