Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access data in Custom buttons/events #294

Open
ritesh-nahar opened this issue Jan 22, 2024 · 0 comments
Open

Access data in Custom buttons/events #294

ritesh-nahar opened this issue Jan 22, 2024 · 0 comments

Comments

@ritesh-nahar
Copy link

ritesh-nahar commented Jan 22, 2024

I have shown 3 buttons inside submitButton container. Below is the code for the same:

<ReactFormGenerator
          key={uuidv4()}
          action_name={t('action.save')}
          onSubmit={onSubmit}
          data={data || []}
          answer_data={getAnswers()}
          submitButton={
              <div>
                  <Button
                      type="primary"
                      htmlType="submit"
                  >
                      Update
                  </Button>
                  <ColorButton
                      style={{ marginLeft: 10, marginRight: 10 }}
                      type="primary"
                      override="colorSuccess"
                      onClick={() => onClick('approve')}
                  >
                      Approve
                  </ColorButton>
                  <ColorButton
                      type="primary"
                      override="colorError"
                      onClick={() => onClick('reject')}
                  >
                      Reject
                  </ColorButton>
              </div>
          }
      />

On click of Approve/Reject button I want to pass "data" as well. How can I access form data? I tried to override onChange event and update state of the answers but then after each keystroke the input component loses focus and I need to click again in order to type the next character.

Screenshot 2024-01-22 at 01 04 46
@ritesh-nahar ritesh-nahar changed the title Access data from Custom buttons/events Access data in Custom buttons/events Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant