javascript - Using dynamic "non Domain" Arguments in Typo3 Extbase Controller -
form-elements added javascript fluid-form not passed argument.
- how right way?
- how dynamically add form-fields javascript?
expected behavior:
- form submmitted "subscribesubmitaction"
- validation of "subscribesubmitaction" fails
- fallback "subscribeaction" called
- "$subscription" set , assigned (not happening) - instead "$subscription" allways null (but subscription.test set in fluid-form)
my guess:
- the propertymapper removing "subscription.childs" because not in "trustedproperties" - how can add them?
- why "$subscription" allways null - have no idea!
controller:
namespace vendor\extension\controller; class eventcontroller extends \typo3\cms\extbase\mvc\controller\actioncontroller { public function initializeaction() { if ($this->arguments->hasargument('subscription')) { //try add "subscription.childs" propertymapperconfiguration $subscriptionconfiguration = $this->arguments->getargument('subscription')->getpropertymappingconfiguration(); $subscriptionconfiguration->allowproperties(); $subscriptionconfiguration->forproperty('*')->allowallproperties(); $subscriptionconfiguration->forproperty('*')->allowcreationforsubproperty('*'); $subscriptionconfiguration->forproperty('*')->forproperty('*')->allowallproperties(); $subscriptionconfiguration->forproperty('*')->forproperty('*')->allowcreationforsubproperty('*'); $subscriptionconfiguration->forproperty('childs')->allowproperties(); $subscriptionconfiguration->forproperty('childs')->allowcreationforsubproperty('*'); $subscriptionconfiguration->forproperty('childs.*')->allowproperties(); $subscriptionconfiguration->forproperty('childs.*')->allowcreationforsubproperty('*'); print_r($this->arguments->getargument('subscription')->getvalue()); // => null } } /** * subscribeaction * @param array $event * @param array $subscription * @ignorevalidation $subscription */ public function subscribeaction($event,$subscription = null) { print_r($subscription); // => null $this->view->assign('event',$event); $this->view->assign('subscription',$subscription); } /** * subscribesubmitaction * @param array $event * @param array $subscription * @param string $g_recaptcha_reponse * @validate $g_recaptcha_reponse notempty */ public function subscribesubmitaction($event,$subscription = null, $g_recaptcha_reponse = null) { /** * method never called because validation of "$g_recaptcha_reponse" must fail (it's empty) */ } }
template:
<f:debug>{subscription}</f:debug> <f:form action="subscribesubmit" name="subscription" object="{subscription}"> <f:form.hidden name='event[]' value='{event.uid}' /> <f:form.textfield property="test" /> <!--suppose added javascript--> <input type="text" name="tx_extension_plugin[subscription][childs][0][test]" value="{subscription.childs.0.test}"> <f:form.hidden name='g_recaptcha_reponse' value='' /> <f:form.submit name="submit" value="submit" /> </f:form>
i recommend check request via network panel of browser. see arguments there? follow naming schema of tx_extension_plugin[subscription][...
? should contained in request within extbase. perhaps shouldn't add them existing argument subscription
instead create argument. can validate same way , errors should available same way within fluid.
you can right "trustedproperties" i'm not sure that. if so, should able workaround within initializeaction
method.
Comments
Post a Comment