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

Animate, HTML5 checkbox, radio button - Initial Values?

Community Beginner ,
Mar 04, 2019 Mar 04, 2019

Copy link to clipboard

Copied

I am attempting to use an Animate HTML5 canvas document with radio buttons and checkboxes.

I would like some of the checkboxes to be initially displayed as checked.

I drag a checkbox component to the canvas, give it a name (chkBox1) and open the component parameters:  There are label, value, disabled, visible and class properties.

The question is how to set the initial value of the checkbox to be checked.

There is a similar question can be asked relative to radio buttons as I would like a default selection identified when first displayed.

Views

2.3K

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

Advocate , Mar 07, 2019 Mar 07, 2019

Hi tmkeeley

The components you add to your HTML5 documents do not become part of the canvas, they become part of the surrounding HTML structure (DOM), particularly the division "dom_overlay_container".

in order to manipulate e.g. the checkbox component you have to use HTML DOM Javascript. In the frame where you dragged a checkbox component to the canvas and named it "chkBox1", add into your code layer the following:

setTimeout(function () {

    document.getElementById("chkBox1").checked = true;

}, 0)

...

Votes

Translate

Translate
Advocate ,
Mar 07, 2019 Mar 07, 2019

Copy link to clipboard

Copied

Hi tmkeeley

The components you add to your HTML5 documents do not become part of the canvas, they become part of the surrounding HTML structure (DOM), particularly the division "dom_overlay_container".

in order to manipulate e.g. the checkbox component you have to use HTML DOM Javascript. In the frame where you dragged a checkbox component to the canvas and named it "chkBox1", add into your code layer the following:

setTimeout(function () {

    document.getElementById("chkBox1").checked = true;

}, 0);

The same property checked is valid too for your radio buttons.

Find more infos here:

Checkbox HTML DOM Input Checkbox Object

Radi button HTML DOM Input Radio Object

Klaus

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
Participant ,
Mar 05, 2020 Mar 05, 2020

Copy link to clipboard

Copied

Instead of a timeout function you can use the JQuery document ready function to initally set a value or whatever.

$(document).ready(function () {
	$("#r1").attr('checked', 'checked');
});

All the ui- Elements are JQuery Elements so if you need a documentation, you should look vor JQuery Components

JQuery UI  

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
Participant ,
Mar 05, 2020 Mar 05, 2020

Copy link to clipboard

Copied

LATEST

Instead of a timeout function you can use the JQuery document ready function to initally set a value or whatever.

$(document).ready(function () {
	$("#r1").attr('checked', 'checked');
});

All the ui- Elements are JQuery Elements so if you need a documentation, you should look vor JQuery UI Components.

JQuery UI 

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