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

Forms: Provide a link to edit an item that was just created #3289

Closed
dtdesign opened this issue May 6, 2020 · 5 comments · Fixed by #3514
Closed

Forms: Provide a link to edit an item that was just created #3289

dtdesign opened this issue May 6, 2020 · 5 comments · Fixed by #3514
Assignees
Labels
Milestone

Comments

@dtdesign
Copy link
Member

dtdesign commented May 6, 2020

Forms are generally designed to reset themselves after submitting and providing a clean form afterwards. There is usually a generic success message at the top, which we can extend to provide a link to edit the just created item.

We should check if it is possible to generate these links automatically without requiring any manual edits.

Partly inspired by https://community.woltlab.com/thread/272406-boxen-speichern-und-nicht-zur%C3%BCck-zur-liste-wechseln/.

@dtdesign dtdesign added this to the 5.3 (next) milestone May 6, 2020
@TimWolla
Copy link
Member

We should check if it is possible to generate these links automatically without requiring any manual edits.

This does not appear to be possible generically. I've checked a few forms and none even expose the ID of the created entity, even less a link to it. With form builder based forms it should be possible, though.

@dtdesign
Copy link
Member Author

dtdesign commented Aug 5, 2020

Most forms do expose the $this->objectAction which does contain the object in $this->objectAction->getReturnValues()['returnValues'];. It should be possible to check if the return value is a wcf\data\DatabaseObject and generate a link using getObjectID()?

@TimWolla
Copy link
Member

TimWolla commented Aug 5, 2020

Most forms do expose the $this->objectAction

In fact that property is part of AbstractForm.

@TimWolla
Copy link
Member

TimWolla commented Aug 5, 2020

Unfortunately the language item that is typically used (wcf.global.success.add) is within the wcf.global category and thus does not support template scripting.

@dtdesign
Copy link
Member Author

Introduce a new template formSuccess that replaces this bit:

{if $success|isset}
	<p class="success" role="status">{lang}wcf.global.success.{$action}{/lang}</p>
{/if}

The template could then offer a proper UI for the user, additionally the form class can assign the specific object (similar to the WCF::getTPL()->assign('success', true) to avoid testing arbitrary return values of the dbo action.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants