Jump to content

Conditional Display Only Based on Database Field


Recommended Posts

Hi,

Just starting with Caspio to determine if it meets the needs for our project. Apologies in advance if this question has already been answered on the forum, but I have looked and can't find anything.

I have a simple user table (see attached). There is a column called 'EMail' and a column called 'CanEmailBeUpdated' (Y/N), the latter determining if the users email can be updated in a form.

I have created a single record update data page which displays the email field. I want to make the email field display only if the corresponding 'CanEMailBeUpdated' field is set to N. I have tried using Rules, but they only seem to work for editable fields (i.e. I would have to make 'CanEMailBeUpdated' editable on the form, which defeats the point).

Any ideas on how this should be achieved would be much appreciated!

UserTable.png

UserEdit.png

Link to comment
Share on other sites

Good idea May. That is definitely the easiest approach, however sometimes rules are limited. If the rules don't work try a CSS & JS solution.

.UpdateRecordCanEMailBeUpdated {display: none;}

var canUpdate = document.getElementById('UpdateRecordCanEMailBeUpdated').value;
var emailEle = document.getElementById('UpdateRecordEMail');

if(canUpdate == 'Yes') {
  emailEle.style.display = "none";
}

*NOTE*

tableUser.CanEmailBeUpdated must be a text field to have an ID = UpdateRecordCanEMailBeUpdated.

Set CanEmailBeUpdated with a dropdown with Yes and No as the only options.

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