Skip to content

Conversation

@MeiKatz
Copy link
Contributor

@MeiKatz MeiKatz commented Sep 30, 2025

<Form /> is a great addition to InertiaJS. But it would be greater if I could use it for sending manual requests to my api and benefit from the other features offered by <Form />. Currently there is no good way for accessing either the form element itself or the data managed by the Form component. I don't want to use useForm() and have to manually handle the state of my input fields. Getting access to the form data as FormData object or as an plain old JS object would be great.

I currently omitted the tests. If the feature is accepted I will add them.

@pascalbaljet
Copy link
Member

Looks good to me!

@MeiKatz
Copy link
Contributor Author

MeiKatz commented Sep 30, 2025

Okay, I will add the tests in the coming hours.

@pascalbaljet pascalbaljet marked this pull request as draft October 1, 2025 14:13
@pascalbaljet pascalbaljet added the needs more info/work Needs more info from the author or additional work to get merged label Oct 21, 2025
@pascalbaljet
Copy link
Member

@MeiKatz Any updates on this?

@MeiKatz
Copy link
Contributor Author

MeiKatz commented Oct 28, 2025

I am still trying to write the tests for this. Until now I wasn't successful with this

@pascalbaljet
Copy link
Member

I am still trying to write the tests for this. Until now I wasn't successful with this

No problem! Shall I write them?

@MeiKatz
Copy link
Contributor Author

MeiKatz commented Oct 28, 2025

This would be great. I guess I can learn from you how to do this in the future if there is another time I like to contribute.

@pascalbaljet pascalbaljet marked this pull request as ready for review October 28, 2025 16:32
@pascalbaljet pascalbaljet merged commit f6ebb89 into inertiajs:master Oct 28, 2025
9 checks passed
await page.fill('#name', 'John Doe')
await page.getByRole('button', { name: 'Test getData()' }).click()

const result = consoleMessages.messages.find((msg) => msg.includes('getData result:'))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, consoleMessages was the missing piece. I didn't know about this and that I could listen to console.log() this way.

@MeiKatz MeiKatz deleted the feat/get-current-values-from-form branch October 28, 2025 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs more info/work Needs more info from the author or additional work to get merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants