I was working with
form_remote_tag()
which is a usefull function if you create forms using AJAX request.
Simple usage is easy
<?php echo form_remote_tag
(array( 'update' =>
'item_list',
'url' =>
'item/add',
)) ?>
Executes the URL Item Add and replaces content of the Element with item_list with it´s result.
Well what i would like to now is a Form which is permanent viewable and will reset itself if sended.
What i guessed
<?php echo form_remote_tag
(array( 'update' =>
'list',
'url' =>
'entrys/create',
'complete' =>
"Form.reset('myForm')",
'id'=>
'myForm' ));
?>
Well who that doesn´t work,
form_remote_tag doesnt know an property called id, you have to hang it behind as html code
<?php echo form_remote_tag
(array( 'update' =>
'list',
'url' =>
'rntrys/create',
'complete' =>
"Form.reset('myForm')" ),
"id='myForm' ");
?>
This way it works, too bad the documentation on it is that poor. But
10 Reasons why Symfony **cks helped me out finding the right solution.
However i still think updating a whole element with the list is the wrong way, i would like to use JSON and DOM Manipulation for that, to add exact one entry to the list, i gonna work that out now.