Results 1 to 5 of 5

Thread: Evaluate Fields from other

  1. #1
    maturs is offline Member
    Join Date
    Sep 2008
    Posts
    7

    Default Evaluate Fields from other

    i need to evaluate a field from other usin enhanced Studio.
    for example i have a button with this code

    echo <<<END
    <script>

    </script>
    <input type="button" value="BUTTON"
    style="background-color: #cc0000; color: #ffffff;"
    onclick=$xtpl->assign(text_c","pepe")

    END
    ;

    I want to know if the onclick sintax i correct
    thanks

  2. #2
    kenshiro is offline Sugar Community Member
    Join Date
    Mar 2007
    Location
    Macerata - ITALY
    Posts
    421

    Default Re: Evaluate Fields from other

    Quote Originally Posted by maturs
    i need to evaluate a field from other usin enhanced Studio.
    for example i have a button with this code

    echo <<<END
    <script>

    </script>
    <input type="button" value="BUTTON"
    style="background-color: #cc0000; color: #ffffff;"
    onclick=$xtpl->assign(text_c","pepe")

    END
    ;

    I want to know if the onclick sintax i correct
    thanks
    No, I don't think it works.

    The onclick needs a single or duoble quote, and the "assign" method may not be executed inside the heredoc.
    You should use the following:

    PHP Code:
    echo '
    <script>

    </script> 
    <input type="button" value="BUTTON"
    style="background-color: #cc0000; color: #ffffff;" 
    onclick="'
    .$xtpl->assign("text_c","pepe").'">'

  3. #3
    maturs is offline Member
    Join Date
    Sep 2008
    Posts
    7

    Default Re: Evaluate Fields from other

    Thanks KENSHIRO, but i couldn't make it work
    Any suggestion??
    Thanks.

  4. #4
    kenshiro is offline Sugar Community Member
    Join Date
    Mar 2007
    Location
    Macerata - ITALY
    Posts
    421

    Default Re: Evaluate Fields from other

    Quote Originally Posted by maturs
    Thanks KENSHIRO, but i couldn't make it work
    Any suggestion??
    Thanks.
    I've just corrected the syntax, I haven't considered what is the action you expect when you click the button.

    If you expected that the onclick method executed a php code, that's not the right way.
    You should use AJAX for this, you can refer to Fedepia's thread or Enhanced Studio thread

  5. #5
    maturs is offline Member
    Join Date
    Sep 2008
    Posts
    7

    Default Re: Evaluate Fields from other

    Thanks Kenshiro, i finally solved the problem using AJAX.

    document.getElementById("text_c").setAttribute("va lue","what i want");

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 0
    Last Post: 2008-06-17, 06:54 PM
  2. Validate Readonly fields
    By Iggby in forum Developer Help
    Replies: 3
    Last Post: 2008-04-25, 12:15 AM
  3. Custom Fields Not Saving Data
    By vantagejuan in forum Help
    Replies: 1
    Last Post: 2008-04-14, 11:17 PM
  4. Replies: 3
    Last Post: 2007-02-05, 09:43 PM
  5. Replies: 1
    Last Post: 2006-09-11, 03:38 PM

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
  •