Automatically add/remove input based on selection?

Automatically add/remove input based on selection?

jacob.steinbergerjacob.steinberger Posts: 86Questions: 18Answers: 1

Is there a built-in method to add/remove input boxes based on previous selections?
For example, if I'm using checkbox or list for a selection option, is there a way to add additional input options based on that selection?

An extremely small example would be "Yes/No", if Yes, add inputbox.

In reality, the initial list select could have a dozen selections, and each could require its own additional input.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin

    This example I think shows what you are looking for?

    Allan

  • jacob.steinbergerjacob.steinberger Posts: 86Questions: 18Answers: 1

    That a big chunk, thank you for that example.

    The complicated (for me) side is when we have a multi-pick list:

    {
      label: "env",
      name: "env[].id",
      type: "select",
      multiple: true
    }
    

    So I'm basically looking at making new inputs per selected 'env', but this is all via an MJoin, relating to a different field.

  • jacob.steinbergerjacob.steinberger Posts: 86Questions: 18Answers: 1

    Alternatively, and what I'm currently trying, is to use InForm data controls to load a new editor to perform the data editing.

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Answer ✓

    So I'm basically looking at making new inputs per selected 'env', but this is all via an MJoin, relating to a different field.

    Oh - thanks for the clarification. That's a whole different ball game! Not only would you need to create a custom form field for this, you'd also need to change the server-side code (assuming you are using our libraries) as they don't support multiple fields per Mjoin (assuming you are using a link table).

    Is nested editing an option for you? That's how I would suggest editing an Mjoin would be done and is far more approachable.

    Allan

  • jacob.steinbergerjacob.steinberger Posts: 86Questions: 18Answers: 1

    It did seem like a mountain of work.

    Nested editing is really close, I'll take a look at it. I'm currently having the user hit a 'second' edit button from the table in order to change the necessary values.

    Thank you so much for link, it helps!

Sign In or Register to comment.