Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


Switch values

Community Beginner ,
May 12, 2021 May 12, 2021

Copy link to clipboard

Copied

This seem so easy but i can't figure it out.

I have two text fields "Text1","Text2" and checkbox "Check" I want to swap two field values with checkbox when checked and switch back when unchecked, any help is appreciated.

TOPICS
How to, JavaScript

Views

473

Likes

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

correct answers 1 Correct answer

Adobe Community Professional , May 12, 2021 May 12, 2021
As Mouse UP event of checkbox use this: var a = this.getField("Text1"); var b = this.getField("Text2"); var a1 = a.value; var b1 = b.value; if(event.value != "Off"){ a.value = b1; b.value = a1;} else if(event.value == "Off"){ a.value = b1; b.value = a1;}

Likes

Translate

Translate
Adobe Community Professional ,
May 12, 2021 May 12, 2021

Copy link to clipboard

Copied

As Mouse UP event of checkbox use this:
var a = this.getField("Text1");
var b = this.getField("Text2");
var a1 = a.value;
var b1 = b.value;
if(event.value != "Off"){
a.value = b1;
b.value = a1;}
else if(event.value == "Off"){
a.value = b1;
b.value = a1;}

Likes

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
Community Beginner ,
May 12, 2021 May 12, 2021

Copy link to clipboard

Copied

LATEST

Thank you so much!

Likes

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