Results 1 to 4 of 4

Thread: Howto store insert tag into Catalog field.

  1. #1
    New user
    Join Date
    10-30-09.
    Location
    Padova - ITALY
    Posts
    8

    Default Howto store insert tag into Catalog field.

    Hi,

    i need to store into a Catalog Field many infomation when a member of contao fill a form of catalog. I use Catalog_edit. There is a way to save the content of insert tag like {{env::ip}} or {{user::firstname}} into a Catalog ? :?:

    Thank you.
    Maurizio

  2. #2
    Experienced user
    Join Date
    08-21-09.
    Posts
    563

    Default Re: Howto store insert tag into Catalog field.

    Edit the catalog_edit template. Add the insert tags you want as values of hidden fields. Just make sure the hidden fields are configured properly to map to an existing catalog field.

    Never actually done this, but I think it would work.
    Brian

  3. #3
    New user
    Join Date
    10-30-09.
    Location
    Padova - ITALY
    Posts
    8

    Default Re: Howto store insert tag into Catalog field.

    I try this:

    Code:
    <tr class="<?php echo $this->rowLast; ?>">
        <td class="col_0 col_first"><label for="ctrl_name">Name</label></td>
        <td class="col_1 col_last"><input type="text" name="name" id="ctrl_name" class="text" value="{{user::firstname}}" disabled /></td>
    and don't work
    and then i try this:

    Code:
    <tr class="<?php echo $this->rowLast; ?>">
        <td class="col_0 col_first"><label for="ctrl_sviluppatore">Sviluppatore</label></td>
        <td class="col_1 col_last"><input type="hidden" name="sviluppatore" id="ctrl_sviluppatore" class="text" value="{{user::firstname}}"  />{{user::firstname}}</td>
    and also this not don't work...

    I see the code
    <?php echo $this->field; ?>
    print the full form in html and there is NO way to change.

    Anyone have another Idea ?

  4. #4
    Experienced user
    Join Date
    08-21-09.
    Posts
    563

    Default Re: Howto store insert tag into Catalog field.

    I just a test out of curiosity.

    I made a new catalog edit module. I copied "catalog_edit.tpl" to my templates folder and edited it by inserting the following inside the form tag of that template:

    Code:
    <input type="hidden" name="TEST_FIELD" value="{{user::firstname}}" />
    It works in that first name now shows up in the rendered HTML.

    If you don't get the same thing, make sure that...
    • You've selected the field as editable[/*:m:3odr0437]
    • You are logged in as a frontend member, and that member group was given permission to edit[/*:m:3odr0437]
    • You're editing on a "reader" page (an item has been selected and appears in the URL)[/*:m:3odr0437]
    • You're editing the right part of the right template[/*:m:3odr0437]


    Now getting that field in the database is a different story. It will probably take some experimentation to get it to work. The field in the catalog probably needs to be editable as well. You may or may not have to hide the text field in some way if you don't want it to show up. And you need to make sure the hidden field maps to the actual catalog field (check name and/or ID attributes).

    Now, there's something else to consider. This MAY NOT be the best idea in the world, depending on how you are going about this. Even though its a hidden field, a devious user could still hack it to change the firstname field to whatever he wants. Just be mindful of the security implications of your implementation. There might be a better way, but this part is a bit over my head.

    Good luck.
    B
    Brian

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •