Javascript - Working with checkboxes

Forum for the PDF-XChange Editor - Free and Licensed Versions

Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

Peter2
User
Posts: 948
Joined: Mon Sep 13, 2010 10:09 am
Location: Switzerland

Javascript - Working with checkboxes

Post by Peter2 »

EDIT:
Please delete this post. I was to quick on posting. It's is more or less obvious ..
Sorry.
-------------------

What I want to reach:
- To add a checkbox A and and textfield B. Done
- Add functionality:
-> When checkbox A is set to ON, the value of field B will be deleted and filed B locked.
-> When A is set to OFF, field B is unlocked.

To research the functionality, I added this JS to the Checkbox:

Code: Select all

var CHK_HOEHEOBEN     = this.getField("CHK_HOEHEOBEN");
app.alert(CHK_HOEHEOBEN.value);
Works fine for the code itself, but I thought the code is "additional" to the basic function:

"Click it vanilla" means "toggle the state"
"Click it with JS" means "toggle the state plus do the JS"

But with JS it only display the alert and does not change the state.

Is there a example for my simple wanted functionality?
PDF-X-Change Pro German
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17960
Joined: Mon Jan 12, 2009 8:07 am
Location: London

Re: Javascript - Working with checkboxes

Post by Tracker Supp-Stefan »

Hello Peter2,

Do you still want us to remove this topic.
As for your checkboxes - I presume this other topic with my sample helps?
viewtopic.php?t=39977

Kind regards,
Stefan
Peter2
User
Posts: 948
Joined: Mon Sep 13, 2010 10:09 am
Location: Switzerland

Re: Javascript - Working with checkboxes

Post by Peter2 »

Tracker Supp-Stefan wrote: Tue Feb 21, 2023 2:41 pm ...Do you still want us to remove this topic...
Yes.
Tracker Supp-Stefan wrote: Tue Feb 21, 2023 2:41 pm ...As for your checkboxes - I presume this other topic with my sample helps?...
Yes.
PDF-X-Change Pro German
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17960
Joined: Mon Jan 12, 2009 8:07 am
Location: London

Re: Javascript - Working with checkboxes

Post by Tracker Supp-Stefan »

Hello Peter2,

OK - please consider this one closed!

Kind regards,
Stefan