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

How to assign a handler to the edittext element ?

Participant ,
May 09, 2013 May 09, 2013

Hello everyone.

How to make so that when you input letters in the edittext, button was unlocked ( not empty input value) or blocked (empty value) ?

#target photoshop;

var w = new Window('dialog', '');

w.orientation = "column";


etProd = w.add('edittext',undefined,'');

etProd.preferredSize = [170,20];

btnProd = w.add('button',undefined,"Save");

btnProd.enabled =false;

w.show();

TOPICS
Actions and scripting
755
Translate
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

correct answers 1 Correct answer

Community Expert , May 09, 2013 May 09, 2013

One possibility:

var w = new Window('dialog', '');

w.orientation = "column";

etProd = w.add('edittext',undefined,'');

etProd.preferredSize = [170,20];

etProd.onChanging = function() {

    if (etProd.text) {

        btnProd.enabled = true;

        }

    }

btnProd = w.add('button',undefined,"Save");

btnProd.enabled = false;

w.show();

a second one:

var w = new Window('dialog', '');

w.orientation = "column";

etProd = w.add('edittext',undefined,'');

etProd.preferredSize = [170,20];

btnProd = w.add('button',undefined,"

...
Translate
Adobe
Community Expert ,
May 09, 2013 May 09, 2013

One possibility:

var w = new Window('dialog', '');

w.orientation = "column";

etProd = w.add('edittext',undefined,'');

etProd.preferredSize = [170,20];

etProd.onChanging = function() {

    if (etProd.text) {

        btnProd.enabled = true;

        }

    }

btnProd = w.add('button',undefined,"Save");

btnProd.enabled = false;

w.show();

a second one:

var w = new Window('dialog', '');

w.orientation = "column";

etProd = w.add('edittext',undefined,'');

etProd.preferredSize = [170,20];

btnProd = w.add('button',undefined,"Save");

btnProd.onClick = function() {

    if (etProd.text) {

    alert("etProd-value: " + etProd.text)

    w.close();

    } else {

        alert("No etProd-value")

        }

    }

w.show();

Translate
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
Participant ,
May 09, 2013 May 09, 2013

Thanks ! I'm to try btn.onChange, but don't know about onChanging

Translate
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
Community Expert ,
May 09, 2013 May 09, 2013
LATEST

You're welcome!

Translate
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