Hide form field based on field from another connected object

I have an app that I am creating to input data from a client. When I added a "visit" record to a "client" I want to hide a field in the "visit" record. However, it seems that I can only hide a view, not just a field in a view. Is there a way to hide just the record? In this example, I have a person that is "male". Since they are male I need to hide the "breastfeeding" field on the visit. ![](upload://olHl0YTQsPtDJqzZ3VlUMjkExPQ.png)

It may go without saying but just to be as complete as possible, make sure you create record rules on the first Add Form that auto-submits so it has the basic data you need depending on how you set-up your form data source but you can record the logged-in Account/Client, Date or time stamp, groups, Client Practitioner... and you can populate them in the Child Edit Form as Display only if you choose.  

Also, if you use the Javascript to automaticaly Add a record, on the Edit Form create a Submit Rule to take them back to a home page or dashboard... you want to make sure they can't return to the Add Form page otherwise it will trigger gain and add another record and you will be in a loop or have duplicates you don't want. If you don't have a Page, create a Thank You page and redirect them to that after Submit.

Here is the Auto-Submit Javascript. Make sure to change the xxx to match your Add Form Scene or Add Form View numbers and only use one or the other:

/* Auto Submit Add Visitation record Button to Add a new record */

/* Use this to auto-submit when a Scene is rendered */
/* 'knack-scene-render.scene_xxx', */

/* Use this to auto-submit when a View is rendered */

function (event, scene) {
// Knack Standard Theme:

// Legacy: Classic and Legacy: Flat Themes:

390912325812 I specialize in the health, wellness and fitness fields and as a Physiologist I have ran into this problem many times on many systems over the years especially when the content differs for males and females. I am guessing that 371928693712 may have expected that your gender field was in the same table as the table containing the Visit record but I think your fields may reside in 2 different objects if I understood your question correctly; the breastfeeding question in one object (Visits) and Gender in an Account or Client object which contains data like name, email, gender, address... am I correct? If so you can't hide and display fields in a Form as you can't mix and match objects on the form. That being said I do have a solution. It involves a bit of a hack where you add a text formula field in the Visit Table Object that you are trying to add a record to, that then records the Account Gender field in that object as well - it will look something like {Client.Gender}.

Next create your form and take all the fields off the form and for now just add a text field or even better just change the Title of the form with a message like "Click Submit" to begin Visitation record..." or something to that affect. (I have a way around this extra step below using JS)

Then under the Form Rules/Submit Rules change your Action to Redirect to a Child Page. It will prompt you to create the Child Page and you are going to add an Edit Form that edits that exact same Object (Visits Table). Essentially you are creating a record and then editing that exact same record when you click Submit.

On the Edit Form add all your visitation questions and make sure to add your Text Formula Gender Field that you created and set it to "Display the field value without a form input" at the top of the Edit Form. At this point I believe there may be a Bug that doesn't display the field value (in your case the Gender) but don't worry it will still work.

Now go to your Form Rules/Display Rules and create a Rule to check the field value of the Gender Field and Hide/Show the Breastfeeding field based on the value of the Gender field. I have some Javascript to make this cleaner that automatically submits the initial form and goes directly to the edit form and makes it transparent to the user just see my posts below. You can also hide the Label on the Gender field and with the bug that isn't showing any value right now it will be transparent to the user. I don't know your level of expertise and experience with the platform so let me know if this makes sense or is confusing as I can record a brief video for you as well. Hope it helps - Dean 

Hey Chris, 

What you are looking for are form display rules. Here is an article on how to use them. 


Please reach out if you need additional assistance.