• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Button and Checkbox scope with Topcoat

Enthusiast ,
Jan 22, 2019 Jan 22, 2019

Copy link to clipboard

Copied

I'm new to topcoat and the markup used, and am trying to test the scope of a button and checkbox relationship I have in my extension. Since it's split into a few files, and I have to reload photoshop every time I want to test a script change, I'm having difficulty finding out exactly where it's occurring. Calling a function through hostscript.jsx that throws "alert(guideCheck.checked)" from a function will tell me the state of my checkbox, but without all the jQuery. Trying to utilize topcoat, I had the below script that I'm trying to figure out. My problem being, since there are multiple files that interact differently, I'm not sure if I'm simply having a scope issue, or if I can even call upon the variable used reliably. I tried to boil down my script to simply alert me, but I can't get photoshop to respond to tell me what "$(this)" is with files opened or closed. Any guidance would be much appreciated.

This is from index.html that renders the form:

<body class="hostElt">

    <div id="content">

<input id="guideTest" name="guideTest" type="checkbox"> Ignore Guides

            <button id="automagic" class="topcoat-button--large hostFontSize" style="width:100%">Automatic</button>

This is from main.js:

    function init() {

        themeManager.init();

        $("#automagic").click(function () {

            csInterface.evalScript('determineSwatchBounds()');

        }); 

    }

This is from hostscript.jsx where I'm trying to get the information of the checkbox from

function determineSwatchBounds(){

alert($(this).attr('guideTest').checked);

}

Visual rendered form below:

TOPICS
Actions and scripting

Views

906

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
Jan 23, 2019 Jan 23, 2019

Copy link to clipboard

Copied

A better place to ask this question may be over in this forum Extensions / Add-ons Development

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jan 23, 2019 Jan 23, 2019

Copy link to clipboard

Copied

LATEST

Good point. I've done so, but it looks like I couldn't otherwise move this one over.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines