[TYPO3-mvc] Flexform and actions

Dawid Pacholczyk dpacholczyk at gmail.com
Sat Oct 23 13:48:31 CEST 2010


Hello List,

 I have a strange problem. For tests I`m creating an extension that can add
some data to database. For example Post (simple as that).

 

I have indexAction (lists every posts), newAction(create form for new Post)
and createActions(adds Post to DB). Everything works perfect

 

I`ve added to this ext a FlexForm where I can set limit of posts per page
and view. VIEW is my problem.

 

FlexForm look like this

 

<switchableControllerActions>

                      <TCEforms>

                          <label>View</label>

                          <config>

                              <type>select</type>

                              <items type="array">

                                  <numIndex index="0" type="array">

                                      <numIndex index="0">LIST</numIndex>

                                      <numIndex
index="1">Post->index</numIndex>

                                  </numIndex>

                                  <numIndex index="1" type="array">

                                      <numIndex index="0">CREATE</numIndex>

                                      <numIndex
index="1">Post->new</numIndex>

                                  </numIndex>

                              </items>

                              <maxitems>1</maxitems>

                              <size>1</size>

                          </config>

                      </TCEforms>

                  </switchableControllerActions

 

When I select LIST I get my list with link to form for adding new one. à
<p><strong><f:link.action action="new">Create new
Post!</f:link.action></strong></p>

The problem is that I get good link but I still get LIST view. Link looks
like this -> http://poligon.loc/index.php?id=2
<http://poligon.loc/index.php?id=2&tx_myext_pi1%5baction%5d=new&tx_myext_pi1
%5bcontroller%5d=Post&cHash=09d49fb0a1535034ce6532799020365f>
&tx_myext_pi1[action]=new&tx_myext_pi1[controller]=Post&cHash=09d49fb0a15350
34ce6532799020365f

 

It looks like FlexForm action is more important the URL action.

 

Secong thing is where I use CREATE and invoke newAction I receive new.html
template BUT when I submit it it doesn`t add data to DB. Below my
createAction and form invoke in new.html

 

      public function createAction($newPost) {

            $this->postRepository->add($newPost);

            $this->redirect('index');

      }

 

<f:form method="post" controller="Post" action="create" name="newPost"
object="{newPost}">      

 

Best regards,
Dawid Pacholczyk

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Dawid Pacholczyk

tel: 502-054-334

gg: 5564051

skype: dpacholczyk

http://typo3blog.pl (only polish version at the moment)

                  

 



More information about the TYPO3-project-typo3v4mvc mailing list