Animate, HTML5 checkbox, radio button - Initial Values?

Community Beginner ,
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.

TOPICS
Discussions

Views

1.2K

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

1 Correct Answer

Advocate , Mar 07, 2019
kdmemory Advocate , Mar 07, 2019
Hi tmkeeleyThe 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)...

Likes

Translate

Translate
Jump to answer Jump to answer
Advocate ,
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

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Participant ,
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  

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Participant ,
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 UI Components.

JQuery UI 

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more