Giter VIP home page Giter VIP logo

Comments (6)

ftasso avatar ftasso commented on June 7, 2024 1

Hello,
I'm using this very interesting plugin!
Also my use case needs a custom onChange for a SELECT field, I would really appreciate an example.

Thank you,
Fabrizio

from volkovlabs-form-panel.

parumsancto avatar parumsancto commented on June 7, 2024 1

It will be very helpful. Please do it.

@ftasso, Thank you, I will look into custom onChange events.

I am thinking of implementing a Custom Code for the onOptionsChange event, which will allow to create dynamic forms.

from volkovlabs-form-panel.

mikhail-vl avatar mikhail-vl commented on June 7, 2024

Hello @lynhnn,

This is how we define SELECT elements. It has predefined onChange event, which updates selected value in Options.

            {element.type === FormElementType.SELECT && (
              <InlineField
                label={element.title}
                grow={!!!element.width}
                labelWidth={element.labelWidth}
                tooltip={element.tooltip}
                transparent={!!!element.title}
              >
                <Select
                  value={element.value}
                  onChange={(event: SelectableValue) => {
                    element.value = event?.value;
                    onOptionsChange(options);
                  }}
                  width={element.width}
                  options={element.options || []}
                  className={highlightClass(element)}
                />
              </InlineField>
            )}

Do you want to have you own custom onChange function? Will it help you?

from volkovlabs-form-panel.

mikhail-vl avatar mikhail-vl commented on June 7, 2024

@ftasso, Thank you, I will look into custom onChange events.

I am thinking of implementing a Custom Code for the onOptionsChange event, which will allow to create dynamic forms.

from volkovlabs-form-panel.

mikhail-vl avatar mikhail-vl commented on June 7, 2024

We implemented various JavaScript hooks and refactoring element states in v3.

from volkovlabs-form-panel.

imReker avatar imReker commented on June 7, 2024

We implemented various JavaScript hooks and refactoring element states in v3.

Any example for this? I checked the commits and didn't find anything related to this use case. Currently onchange is a function to change element, rather than a event trigger which will be called on element's value has changed.


Solved by using Show if returned value is true, tricky but works.
Example:

const list = elements.find(
  (element) => element.id === 'list'
);
const count = elements.find(
  (element) => element.id === 'count'
);

if (list) {
  count.value = list.value.split('\n').length + "";
}

return true;

from volkovlabs-form-panel.

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.