Jump to content

How Do I Hide a Single Field Using Javascript?


Recommended Posts

I have a field named "CombinedField" which combines the values of two fields using Javascript. Caspio's platform forces me to show this field on my webform (I don't have the option to hide this field using their wizard). However, I need this field to be hidden (work in the background).

So, I'm thinking I need to use Javascript to hide this field. I've tried two different javascript codes (see below), but neither seem to work.

document.getElementById("CombinedField").style.display =†noneâ€;

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

Can someone please tell me what I'm doing wrong? I'm assuming this is fairly simple, but I can't get this to work.

Thanks in advance!

Link to comment
Share on other sites

Hi,

I agree JavaScript requires some playing around..So keep trying :)

It is essentially Event based.

Put in simple words, you can say JavaScript works like:

If "This Action" happens,

Give "This Reaction".

In your script you have the "This Reaction" but you are not specifying that the JS compiler needs to give this Reaction on which Action.

So change your code as:

window.onload =document.getElementById("CombinedField").style.display ='none';

Hope this helps.

Thanks

Megha

Link to comment
Share on other sites

I cut and pasted your solution, but it still isn't working. So, I surfed the web some more and tried to the following code (see below) and it also isn't working. I can't believe that hiding a field is this complicated. Do you have any other suggestions? Also, should the code (once it's corrected) be placed in the header or footer portion of my datapage? Thanks again for your help.

function load()

{

document.getElementById("CombinedField").style.display ='none';

}

document.getElementById("caspioform").window.onload=load;

Link to comment
Share on other sites

  • 9 years later...

Hi @jayandang,

 

Another way to hide the field on your form is to set the form element to "Hidden" or surround it using HTML table tags and setting the table’s display style to “none”.

For more information, you can check this howto document: https://howto.caspio.com/tech-tips-and-articles/common-customizations/how-to-hide-fields-in-datapages/

 

Regards,

kristina

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
Reply to this topic...

×   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...