This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
anybody worked on this before? form AfterSave() refresh?
after save, updated_at does not update in form.
how do i do this?
let me explain.
i have a form(1)
and the slug is generated automatically once its created or changed. like robot directory /this_is_the_path_directory, it takes in the value and str::slug() it.
when this is saved, i made it so that the slug is automatically generated by
$this->directory = Str::slug($this->slug)
so it would be the slug to /this-is-the-path-directory, the form is disabled with the previous slug(not:this-is-the-path-directory). so when the path directory is changed so is the slug, but when i click on save, it does not update to the new slug or updated_at for that matter.
assuming, that slug and updated_at is a text box, disabled, but showing the value of it.
So how do i update the fields after save?
Last updated
managed to fix this by in config_form.yaml
update:
title: Edit Existing Robots.txt
redirect: devnull/robot/robots/update/:slug
redirectClose: devnull/robot/robots
flashSave: Post updated successfully!
flashDelete: Post has been deleted.
and in update.htm
<button
type="submit"
data-request="onSave"
data-request-data="redirect:1"
data-hotkey="ctrl+s, cmd+s"
data-load-indicator="Saving Robot..."
class="btn btn-primary">
<u>S</u>ave
</button>
Last updated
I've managed to solve this problem using ajax framework:
If you insert form element as PARTIAL you can invoke ajax reload of element on submit.
<button
...
data-request-update="some_partial: '#target-wrap'"
...
</button>
As described in this document: https://octobercms.com/docs/cms/ajax#how-ajax-works
Last updated
1-6 of 6