Copy link to clipboard
Copied
Hi all.
I want to make sure that after processing in the script has changed the status of control elements (buttons, input fields). But to access the properties of an element I have succeeded only in main.js. And most of the processing will be in the file hostscript.jsx .
For example, btn_test1 does not show properties, and btn_test1 shows. How to interact with the js files and how do I access the properties of objects in the resource file hostscript.jsx
Thanks for the quick reply. I found a solution ... From file jsx returns "result" = name blocked button, which is applied to the element. For one button, just for a few - need to pass an array
HTML
<table width="100%" border="0" padding="10">
<tr><td><button id="btn_test1" class ="btnType1">Test1</button></td>
<tr><td><button id="btn_test2" class ="btnType1">Test2</button></td>
</table>
JS
$("#btn_test1").click(function () {
csInterface.evalScript('sayHello()', function(result) {
document.getElement
...Copy link to clipboard
Copied
Short version is that when you use csInterface.evalScript you send it to Photoshop JS environment ESTK to be executed, it knows documents, but not your HTML (and vice versa for the main.js). See How to Call a Function for more details. It's a critical architectural decision what tasks/logic is done in the panel JS context and what in Photoshop.
Copy link to clipboard
Copied
Thanks for the quick reply. I found a solution ... From file jsx returns "result" = name blocked button, which is applied to the element. For one button, just for a few - need to pass an array
HTML
<table width="100%" border="0" padding="10">
<tr><td><button id="btn_test1" class ="btnType1">Test1</button></td>
<tr><td><button id="btn_test2" class ="btnType1">Test2</button></td>
</table>
JS
$("#btn_test1").click(function () {
csInterface.evalScript('sayHello()', function(result) {
document.getElementById(result).disabled=true;
});
JSX
function sayHello(){
return("btn_test2");
}