Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

How to implement a controller for a widget with a form #15101

Closed
ovekaaven opened this issue Jan 15, 2024 · 1 comment
Closed

How to implement a controller for a widget with a form #15101

ovekaaven opened this issue Jan 15, 2024 · 1 comment

Comments

@ovekaaven
Copy link
Contributor

It would be nice to have documentation, or an example, for how to do the following:

Part 1 (easy enough): a widget that contains a form written in Razor. (Orchard Core's own Forms module is too inflexible.)

Part 2 (the part I can't figure out): a controller implemented in C#, that would check the submitted form data and if there's a mistake, can send the user back to the original page with the form contents still intact, so the user can correct the mistake and try again. (Not that difficult if there's no need to remember the form contents, but there is, and I have no idea how to get the form data back to the page.)

Our website has been OC-based for close to a year and I still don't know how to do it. I once tried to look at the source code of the Forms module to see how it does it, but it was a total mess and I couldn't follow it.

@MikeAlhayek
Copy link
Member

@ovekaaven

Orchard Core's own Forms module is too inflexible.

Maybe list what you would like to accomplish here so we know the limitation.

Part 2 (the part I can't figure out)
Are you using Workflow to handle the submitting logic? If you, I recently implemented a workflow task that does what you seems to be after Http Redirect To Form Location Task. So when the validation failed, you can just redirect back to the form.

@OrchardCMS OrchardCMS locked and limited conversation to collaborators Jan 16, 2024
@Piedone Piedone converted this issue into discussion #15102 Jan 16, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Projects
None yet
Development

No branches or pull requests

2 participants