How to enable a checkbox using code

I have created a field in a form and assigned it as a checkbox. How do i programmatically enable or disable this checkbox?

Re: How to enable a checkbox using code

Just Check/Uncheck Default value of your checkbox field.

Re: How to enable a checkbox using code

Hello,

Grab its ID, and set it to disabled.

regards,
Bernhard Bernsmann

Re: How to enable a checkbox using code

when you say “grab its ID and set it to disabled”, how do you code it?

{unchecked} = “disabled”;

Re: How to enable a checkbox using code

Well,

You could try to grab its ID using Firebug for instance, and to set it to disabled it could be done via JavaScript.

regards,
Bernhard Bernsmann

Re: How to enable a checkbox using code

Do you mean :
we have a table code =
CREATE TABLE checkbox (
ID INT(10) NOT NULL AUTO_INCREMENT,
SEX INT(10) NULL DEFAULT NULL,
as VARCHAR(50) NOT NULL DEFAULT ‘0’,
PRIMARY KEY (ID)
)
COLLATE=‘latin1_swedish_ci’
ENGINE=InnoDB
AUTO_INCREMENT=3;

i want to hide/read only AS field if we have value=‘laki’ -->

if({as}==‘Laki’)
{
sc_field_display({sex},off);
}

or you could use sc_field_readonly({Field}, on/off) macro onLoad Events for exmple.

Slide4.JPG