question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Form Constants or Hidden Fields.

See original GitHub issue

I have a schema that includes a few array properties that I need to include a property on the array’s contents objects. The property differs depending on which object in the array it is.

For example:

Schema:

{
  type: 'object',
  title: 'MyObj',
  properties: {
    PointOfContact: {
      type: 'array',
      items: {
        type: 'object',
        properties: {
          isPrimary: {
            type: 'boolean',
          },
          Name: {
            type: 'string'
          }
        }
      }
    }
  }
}

So for my form, I need to display primary POC and alt POC fields.

Form:

[
  {
    key: 'PointOfContact[0].Name'
  },
  {
    key: 'PointOfContact[0].isPrimary'
  },
  {
    key: 'PointOfContact[1].Name'
  },
  {
    key: 'PointOfContact[1].isPrimary'
  }
]

I need my model’s PointOfContact[0].isPrimary to = true, and false otherwise. I’d rather not have this field displayed because it doesn’t make sense to do so. I have similar cases where objects in the array need to be displayed as fields in the form, but for the model, I need to include a specific foreign key value for that field’s target object.

My understanding is, the point of schema forms is to reduce the need for doing things manually, so the lack of an ability to apply a value to the modal without rendering it on the form, or supplying a hidden input type even is boggling.

I guess I could create a new form type ‘hidden’ to supply the additional values I need to my model?

So my question to the community: Am I approaching this wrong? What am I missing here?

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:16 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
krptodrcommented, Jun 23, 2020

None of these Plunkers exist anymore. Can anyone please provide a new one?

1reaction
kysecommented, May 4, 2016

Sure, does this link work for you? https://plnkr.co/NsEzQGz5DoRdD018RTWn

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using Hidden Fields - Help Center - Typeform
Hidden Fields are a Free feature allow you to use data that you already have, track information about your respondents, and make your...
Read more >
HTML input type="hidden" - W3Schools
A hidden field lets web developers include data that cannot be seen or modified by users when a form is submitted. A hidden...
Read more >
Hidden Form Fields (Java Servlet Programming)
In a sense, hidden form fields define constant variables for a form. To a servlet receiving a submitted form, there is no difference...
Read more >
Learn More About the Hidden Field Option - WS Form
The hidden field lets a form include data that cannot be seen or modified by users when a form is submitted.
Read more >
How to use the hidden field block - Tripetto Help Center
Hidden fields are like hidden gems. Use them to make your forms and surveys more personal. Or keep track of your respondents or...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found