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

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

776

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

Community Expert , 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;}

Votes

Translate

Translate
Community Expert ,
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;}

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

Copy link to clipboard

Copied

LATEST

Thank you so much!

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