Video Screencast Help

Making a Checkbox not Editable

Created: 24 Sep 2013 • Updated: 24 Sep 2013 | 4 comments

I have multiple approval levels (approval 1, approval 2, etc) and would like to have the checkbox editable only at the the level 1 approval. I tried adding another checkbox that controls the editbility and putting javascript  (Disable Control by Value) back to the reference checkbox and that works. However, once I set the checkbox that controls the editbility to false the javascript doesn't run. Is there another way to show a checkbox that is not editable?

Disable Control 1.png

Disable Control 2.png

 

Operating Systems:

Comments 4 CommentsJump to latest comment

reecardo's picture

If possible, could you attach a sample project? (still kind of unclear what behavior you need)

As an option, you could try setting the value and hiding the checkbox, so the users do not see it given a certain value. You can do this via JS or hooking up the Visible property to a dynamic model. (the model would check the stream for a certain value, and given that value, the End component would be either True or False)

I'm pretty sure you can still do this in JS... having a control be disabled shouldn't affect whether certain script is run; it only affects whether you can read its value.

Aryanos's picture

Hi reecardo,

I want to display the checkbox on the approval form so that the approvers can see whether or not that checkbox has been checked. As I workaround I just created a string with a 'Y' and 'N' to display on the form depending if it was checked or not but I would prefer using a checkbox if I can. I've included a sample project for you.

AttachmentSize
CheckboxExample.package 1.37 MB

I like my beats fast and my bass down low

reecardo's picture

Ok, it's sort of ugly, but I got this to work (I'm attaching your appended project with the fix)

Here's how I did it:

I added a textbox to the form that holds the value of the approval level. I give it a control ID of txtCurrentApprovalLevel. Then I gave the checkbox a control ID of chkMyCheck. I added an onload event to the form body with the following script:

var mytext = document.getElementById('txtCurrentApprovalLevel');

mytext.style.display = "none";

var mycheck = document.getElementById('chkMyCheck');

if (mytext.value == 1)

{

mycheck.disabled = false;

}

else

{

mycheck.disabled = true;

}

If you notice, I immediately track down the textbox and hide it onload, so you see a brief flash of it. I have to do it this way because using the Visible property of a component causes it to not even render... so I just change the visibility in the style. You can go about this a different way than a hidden text box... like reading the label displaying the current approval level (much cleaner solution in my opinion).

But anyway... there you go. Hope this helps :)

AttachmentSize
CheckboxExample.package 1.42 MB
Aryanos's picture

Hi reecardo,

Thanks for the project but it looks like the check disappears at approval level 3 but the check box is disabled. You don't have to put anymore time into this as it was only a nice to have and I found a workaround.

I like my beats fast and my bass down low