Git Product home page Git Product logo

Comments (6)

ethib137 avatar ethib137 commented on July 18, 2024

I also noticed that the multiSelect creates a new hidden input for every new item selected, I think this might be wrong and it should instead aggregate all the values into something like .

Hey @bryceosterhaus for this one, it is a little odd, but portal currently uses it that wya in many places. Most notably assetCategories and assetTags use it in this way. You'd need to make sure it wouldn't break the existing uses in Portal.

from clay.

bryceosterhaus avatar bryceosterhaus commented on July 18, 2024

@ethib137 is it expected they have the same nametoo?

For some reason I thought name must be unique, but according to this, it is expected that checkboxes can have the same name.

from clay.

ethib137 avatar ethib137 commented on July 18, 2024

Yes, same name is allowed for all inputs, and it’s expected in this case. When you access the Param on the backend it returns an array of all the values.

from clay.

bryceosterhaus avatar bryceosterhaus commented on July 18, 2024

ah I see.

I think my original issue still stands though... I think changing the values in MultiSelect should also reflect in a forms onChange

from clay.

matuzalemsteles avatar matuzalemsteles commented on July 18, 2024

I'm looking into this right now, we may probably have some native bugs here that won't work correctly or maybe due to how the multi select behavior works, for example adding labels as commented above creates an input[hidden] for each label so that it arrives at the backend as an array, I think that adding a new input with the value of the label will not call the onChange of your form just in case you change the value of that input which is not the case.

Unfortunately I don't think we can change this behavior or try to simulate it for the MultiSelect labels case, I think what we can do here is just add the name to the MultiSelect input that is going to the one input[hidden] which is not necessary in my view here.

I would say that you could use Formik here to control all the states of your form it would be "simpler" to deal with dynamic components like MultiSelect.

from clay.

bryceosterhaus avatar bryceosterhaus commented on July 18, 2024

I think I tried formik with a Form and MultiSelect and it didn't work properly because it wasn't able to hook into the onChange of multi-select.

Do you have an example of formik + multiSelect working?

from clay.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.