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

[Cheetahtemplate-discuss] Create html buttons dynamically

Expand Messages
  • Váry Dániel
    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
    Message 1 of 2 , Dec 2, 2009
    • 0 Attachment
      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,

      Dan

      <!-- PATH STAT NUMBER ERROR -->

      ------------------------------------------------------------------------------
      Join us December 9, 2009 for the Red Hat Virtual Experience,
      a free event focused on virtualization and cloud computing.
      Attend in-depth sessions from your desk. Your couch. Anywhere.
      http://p.sf.net/sfu/redhat-sfdev2dev
      _______________________________________________
      Cheetahtemplate-discuss mailing list
      Cheetahtemplate-discuss@...
      https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
    • tyler@monkeypox.org
      ... Yeah, a #for loop is likely you re best candidate: #for name in $buttons #end for That will cause those
      Message 2 of 2 , 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
      Your message has been successfully submitted and would be delivered to recipients shortly.