Question about Form manipulation

In a Form, how do I block the sending of data from a component during a submit action?

Example:

In a Form I have a checkbox input and I don't want it to be sent during the submit action.

I've already tried adding a Dynamic Attribute/Input/Dizable to set an action that triggers when the Form's state is == executing, but it didn't work.

Can anyone help me?

I managed to do it this way, but I'd like to know if there's another way.

1st - Created a hidden input outside the form called not_send.
2nd - In the checkbox, a 'Dynamic Attributes' was set to 'Disabled' when the hidden input not_send is != empty.
3rd - The button on the form was deactivated (type = Submit).
4th - A 'flow' action was added to the button click, creating 4 actions: 1 - Set a value in the not_send input, 2 - Set a 'Wait' of 100ms, 3 - After that, a Run in the Form with a Submit() and a set in not_send with an empty value.

It worked, but I'd like to know if there's a different way because I don't know if this is the best scenario.

Sorry, I've read this a few times and I can't understand what exactly do you need..
Can you be more specific please?

What is the purpose of your check box if you don't want to send the data? Where are you sending the data to? IS it an insert into a database?

Hi, how are you? I think I was a little too specific...lol I think it must be because of the translator. But let's go, I'll try to be more direct.

I have a form with several input fields.

If I send this form to the backend, it will send all the input fields within the form, correct?

I would like that when the form is submitted, one input field does not send its data to the backend.

Do you understand?

When working with checkboxes and saving to a database, I don't use the checkbox itself to handle the data. I always use a hidden text input because I find it easier to handle strings, which is what I use in the backend in these cases.

So in this case, the checkbox is inside the form, but I don't want to send its data, only the text input linked to it.

I've tried using the checkbox directly, but I couldn't get used to it.

You can handle it on the backend, and just leave it there, without effect..

But if you want to avoid the "payload" (what the form sends to the backend) maybe you can remove the name attribute:
Go to the code and delete name="myInput"

What I mean is: There's no problem if you send something to the backend and don't use it later..
You can have a checkbox name="checkbox1" and not insert it anywhere on the API, it's just only "info"
It's the backend itself (and the actions you choose) who takes care about what do to with that "info"

1 Like

Not unless you specify it. In your insert action just don't include the field you don't want sent.

I perfectly understood your suggestion regarding the 'name' attribute.

Regarding handling the data on the backend, I'm treating the sent POST as an array, and within a 'rep' loop I have an update request to the database.

I use this in the creation of dynamic forms on the frontend, so the idea was to reduce the data processing on the backend. I won't handle it because each new field is another iteration of the 'rep' loop.

I apologize if I seem rude or have difficulty explaining something. Unfortunately, in our country we don't have much knowledge of English, so the blame will always fall on the translator...

From Argentina here so don't worry, I know what it feels haha..

So your repeat expression is: {{_$POST}}?

Thinking loud, but try this:
On your backend, delete that _$POST input from the list (only the one you don't need)

que buen hermano...soy de Brasil
I'll try your tips. I'll let you know if anything comes up...

gracias

1 Like

You’re overcomplicating this a bit. The hidden input isn’t needed at all.

A checkbox already does what you want by default:

<input type="checkbox" name="my_option" value="1">
  • If it’s checked → my_option=1 is sent
  • If it’s unchecked → nothing is sent at all

So you can just use the checkbox value directly. There’s no need to disable anything or sync values with a hidden field.

Hi, @Teodor how are you?

I'm still learning, I won't always make the best decisions, and English is still a problem for me. The only place I know to ask questions is here in the community.

But I understand, thank you for the clarification.