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

Multi-line issue with text areas #475

Closed
bperun123 opened this issue Aug 23, 2024 · 3 comments · Fixed by #477 or VolkovLabs/volkovlabs.io#784
Closed

Multi-line issue with text areas #475

bperun123 opened this issue Aug 23, 2024 · 3 comments · Fixed by #477 or VolkovLabs/volkovlabs.io#784
Assignees
Labels
question Further information is requested
Milestone

Comments

@bperun123
Copy link

bperun123 commented Aug 23, 2024

Thanks for your fast reply.

I think I found one more issue at text areas:
image

If I update a multiline statically, everything works fine:
image

However, if I switch back to the payload of the text area, it breaks:
image

Maybe you can check on your side, if this is also an issue which should be fixed.
I assume an issue at payload converting in terms of multi-line strings...

Thanks a lot :)

@mikhail-vl mikhail-vl self-assigned this Aug 23, 2024
@mikhail-vl mikhail-vl added the question Further information is requested label Aug 23, 2024
@mikhail-vl mikhail-vl added this to the Forms 4.4.0 milestone Aug 23, 2024
@vitPinchuk
Copy link
Contributor

@bperun123 Thanks for the question.

We will add appropriate updates to the documentation. It is an interesting case.

Create Payload code editor should contain the following logic:

  1. Find element refer to TextArea
  2. Add replace logic to value payload[element.id] = element.value.replaceAll("\n", "\\n");

here is example

const payload = {};

context.panel.elements.forEach((element) => {
  if (!element.value) {
    return;
  }

  /**
   * Required logic to update the value 
   */
  if (element.id === 'description2') {
    payload[element.id] = element.value.replaceAll("\n", "\\n");
    return;
  }

  payload[element.id] = element.value;
})


console.log('console >>> upd payload', payload)

/**
 * Data Source payload
 */
return payload;

image

This allows the line break to be properly converted

Here is my full example, please base it on it

image

Create payload

image

28.08.2024.16.55.52.webm

@bperun123
Copy link
Author

Thanks a lot for your fantastic work!!

@mikhail-vl
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
Archived in project
3 participants