Ad
I Have This Code, When Submited The Form Dont Refresh, Someone Know How Refresh After Submit On October Cms?
<form data-request="onSend" data-request-update="'{{ __SELF__}}::attbanco': '#banco' "
data-request-flash >
<table>
<tr>
<td>Nome: </td> <td ><input type="text" id="nome" name="nome"></td>
</tr>
<tr>
<td>Idade: </td> <td ><input type="number" id="idade" name="idade" value="{{usuario.idade}}"></td>
</tr>
<tr>
<td>Telefone: </td> <td ><input type="text" id="telefone" name="telefone" value="{{usuario.telefone}}"></td>
</tr>
</table>
<button type="submit" >Enviar</button>
<input type="hidden" value="{{usuario.id}}" name="id">
this code work, saves the values on database, but i need manually refresh page to see the result on my screen, someone know how refresh after submit? Please, explain most simple possible, i am newbie
Ad
Answer
The best way to do what you want is to put the form in a partial and update it when the form is submitted.
Replace your form with this:
<div id="specialForm">
{% partial __SELF__~"::specialForm" %}
</div>
Create a partial to describe the form; I used specialForm. It should reload the form and clear the content.
<form data-request="onSend" data-request-update="'{{ __SELF__}}::attbanco': '#banco', '{{ __SELF__ }}::specialForm': '#specialForm' "
data-request-flash >
<table>
<tr>
<td>Nome: </td> <td ><input type="text" id="nome" name="nome"></td>
</tr>
<tr>
<td>Idade: </td> <td ><input type="number" id="idade" name="idade" value="{{usuario.idade}}"></td>
</tr>
<tr>
<td>Telefone: </td> <td ><input type="text" id="telefone" name="telefone" value="{{usuario.telefone}}"></td>
</tr>
</table>
<button type="submit" >Enviar</button>
<input type="hidden" value="{{usuario.id}}" name="id">
</form>
Ad
source: stackoverflow.com
Related Questions
- → How do I create an array from a single form input box with php on octobercms?
- → Setting a default value on settings form return null in Octobercms
- → Laravel {!! Form::open() !!} doesn't work within AngularJS
- → How to handle Token Mismatch Exception
- → How to unit test forms with Sinon and Chai
- → Insert values from FORM to DB using AJAX on october cmd
- → October cms, plugin, forms that accepts input from user in front-end of the web
- → Adding html data attribute to simple_forms input
- → Do something before form submit
- → Insert data into 2 different tables from a single form using OctoberCMS Builder Plugin
- → Using ReactJs, How do I update my form fields when my parent object sent in from props changes?
- → Make default attribute for Model in October CMS
- → OctoberCMS plugin form database relationships
Ad