php - Symfony 2.3: Remember form inputs while visiting another site -
what have:
a form several different input fields etc. interesting part collection field:
$builder->add( 'publicationauthors', 'collection', array ( 'type' => new authorpublicationtype(), 'allow_add' => true, 'allow_delete' => true, 'by_reference' => false, 'label' => 'autoren' ));
this collection refers formtype, including entity field , order id:
public function buildform(formbuilderinterface $builder, array $options) { $builder->add( 'author', 'entity', array ( 'class' => 'indpubbundle:author', 'multiple' => false, 'label' => 'autor', 'query_builder' => function (entityrepository $er) { return $er->createquerybuilder( 'a' ) ->orderby( 'a.author_surname', 'asc' ); } $builder->add( 'order_id', 'hidden'); )); }
via js able add new collection form fields form user can choose several of authors , order them.
what need:
so far, user can choose existing authors due entity field. want enhance form such user able create new authors , use these in form. thought of adding button redirects user new form can create new author. then, after submitting form, user should redirected original form , continue fill out.
the main problem here is, want remember user's previous inputs original form doesn't need start over. there way remember these inputs while user using author creation form?
i thought of remembering data in session, there problem that: if user open new tab, might overwrite old form inputs, since session id same both tabs.
okay found solution satisfying me. basically, take whole form data, serialize , remember in hidden form field. because serialize function returns several signs not useable in html, encode string base64.
Comments
Post a Comment