× Warning! This forum is in archival status. New contributions may not work.
Cookbook form example
  • Vote Up0Vote Down Daniel JamesDaniel James
    Posts: 844Member, Sourcefabric Team
    Hi devs,

    This is almost the last question on the Cookbook for a while :-)

    The chapter 'General form elements and functions' contains the following
    example:

    {{ camp_edit object="user"
    attribute="name"
    html_code="id=\"userNameInput\"" }}

    will output:

    <input type="text" name="f_user_name" size="50" maxlength="255"
    id="userNameInput">

    I don't see how that follows, the code does not specify the input field
    size. Also, it's not clear how the field name "f_user_name" is generated
    from object="user" and attribute="name".

    Cheers!

    Daniel
  • 2 Comments sorted by
  • The size and max length are hard-coded. The field "f_user_name" is needed in
    the form, the template engine reads this field from the form to perform the
    login operation. This is just an example of what is generated from this
    code, but the user doesn't care about this HTML.

    Mugur Rus
    Senior Software Developer, Sourcefabric
    mugur.rus@sourcefabric.org

    Cluj-Napoca, Romania
    +40 (0)720 528408
    Skype: mugur_rus

    http://www.sourcefabric.org
    http://www.twitter.com/Sourcefabric



    On Wed, Jun 1, 2011 at 6:26 PM, Daniel James <
    newscoop-dev@lists.sourcefabric.org> wrote:

    > Hi devs,
    >
    > This is almost the last question on the Cookbook for a while :-)
    >
    > The chapter 'General form elements and functions' contains the following
    > example:
    >
    > {{ camp_edit object="user"
    > attribute="name"
    > html_code="id=\"userNameInput\"" }}
    >
    > will output:
    >
    > <input type="text" name="f_user_name" size="50" maxlength="255"
    > id="userNameInput">
    >
    > I don't see how that follows, the code does not specify the input field
    > size. Also, it's not clear how the field name "f_user_name" is generated
    > from object="user" and attribute="name".
    >
    > Cheers!
    >
    > Daniel
    >
    >

  • Vote Up0Vote Down Daniel JamesDaniel James
    Posts: 844Member, Sourcefabric Team
    Hi Mugur, thanks for the clarification, I'll leave that example as it is.

    Cheers!

    Daniel