Jump to content
  • 0

How to hide a virtual checkbox


sferraro

Question

Hi...

I am creating an application that, among other fields, uses two checkboxes. If the first checkbox is checked, the second checkbox is visible (or enabled). If the first checkbox is unchecked, the second checkbox is invisible (or disabled). The first checkbox is bound to a datatable field. The second checkbox is a virtual field type.

I've tried everything I can think-of, but I can't make the second checkbox disappear or disable it. I tried modifying the JavaScript code on the Caspio Website that is supposed to disable a second drop-down list based on the first drop-down's selection - it didn't work either.

My latest (and leanest) script is below. Can anyone out there help me with this?

function hideit()

{

if(document.forms.caspioform.Dependent_Coverage.checked==true)

{

document.forms.caspioform.Virtual1.style.visibility='hidden';

} else {

document.forms.caspioform.Virtual1.style.visibility='visible';

}

}

onload=hideit;

document.forms.caspioform.Dependent_Coverage.onchange=hideit;

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Hi

First thing is that you should refer to Caspio elements by calling their IDs for example see the code below which hides a field on a check box checked in a details page of a Search and Report DataPage (test and email are the field names):

document.getElementById(\"EditRecordtest\").onclick = hide;

function hide(){

if (document.getElementById(\"EditRecordtest\").checked)

{document.getElementById(\"EditRecordemail\").style.display=\"none\";}

else

{document.getElementById(\"EditRecordemail\").style.display=\"block\";}

}

Fields in Caspio Web Form could be referenced as InsertRecordFIELDNAME and in details form could be referenced like EditRecordFIELDNAME however it is a virtual field in the form the Id might be different. You could grab these element Ids if you pullup the DataPage URL (CLick on deploy button, deploy as

URL, copy the URL and paste it in the browser), this way you could see the source of the webpage and find all the elements Ids so you can call them by refering to theor Ids like what you see in the above code.

Hope it could help.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...