Typo3 form submit to another view - forms

I've made an extension in Typo3 6.2 with extbase and fluid.
I've 2 actions in my controller
- action 1 (single) : simply show an object and a form (some filter for object list)
- action 2 (list) : show the same form as in action 1 and treat form result and show a list of object
in my two views, my form looks like :
<f:form action="list" controller="MyController" pluginName="MyPluginName" name="myName">
...
</f:form>
the MyPluginName refere the the 2nd view (list)
When i submit the form from the 2nd view (list), the action recieve correctly the form params
But, when i submit it from the 1st view (single), i'm correctly redirected to the 2nd view BUT with a Typo3 Error :
#1320830276: A hashed string must contain at least 40 characters, the given string was only 9 characters long. (More information)
So, how can i achieve this?
Thanks

for a form, you have to set the action to non-cacheable in ext_localconf.

Related

can we add form on activeadmin index page in rails 4

I'm rendering a partial in my index page
index do
.
.
div id: "overlay-select-period" do
render partial: "select_period", locals: { period: GoalCalender.legend_name_year, record: UsersGoalCalender.new }
end
.
.
end
and in this partial (.html.erb) under app/views/admin/users_goal_calendars, I'm having rails form helper form_for used
but when I run the app, it doesn't show the form tag on the view <form></form>
can anyone tell me whether we can add such form in activeadmin index page?
P.S. I've tried all other ways to add form (formtastic, simple form
and form_tag), and writing the form directly inside index do...end
(without rendering a partial) with no luck
I know this is an old question but I just discovered myself that AA somehow removes your form tag if batch actions are enabled.
This is because enabling batch actions wraps most of the page in a form and nested forms are not fun.
The mention something about it here if you scroll all the down: https://activeadmin.info/9-batch-actions.html
I tried disabling batch actions and the form tag comes back.

In-line item editing in Lift / handling 2 different form submit needs on one page

OK, so first off, let's start with me acknowledging that the bind( ... ) way of binding Lift forms is so last week! :) I do know that, and I just haven't gone back to update this code yet. Also, I trust now that there's some really slick Lifty way to do this. That's what I seek. I'm stumped as to even how to hack something together. That said...
I have a list of Items that I initially display non-editable, and the title of each Item is an ajax-enabled link that calls to the server and replaces that line-item with an editable form of the Item (I use SetHtml to swap the form in at the < li> that listed that Item).
"parent" Items List view looks something like this
< form data-lift="form.ajax">
< div data-lift="creategamewizard?multipart=true" id="wizardform">
< ul>
< li>Item 1< /li>
< li>Item 2< /li>
< /ul>
some more form elements
< button>Submit< /button>
< input type="hidden" id='298356928734' />
< /div>
< form>
This ajax submit (via the hidden field) calls processSubmit().
The SetHtml that swaps in the editableItem form looks something like this.
NOTE: At the end of the following listing, the "save" binding has no server-side code tied to it because the "parent" submit button is already on the page, and when I put another hidden field in this binding or tried to tie any code directly to the Edit Item Save button, that code and the "parent" submit got triggered. So the approach below was to try to use the "parent" submit for both the parent submit as well as the Edit Item submit.
<a href="javascript://" onclick={ajaxOnClickHandler(editItemClickHandler(item.id.get))}>{item.title.get}</a>
def ajaxOnClickHandler(jsHandler: ()=>JsCmd) =
{
SHtml.onEvent( e => jsHandler()).toJsCmd+";return false;"
}
def editItemClickHandler(itemId: String): ()=>JsCmd = ()=>
{
trace.logAjaxComm("ExistingItem.Edit()")
JsCmds.SetHtml("LiId"+itemId, getEditableItem(promo) )
}
def getEditableItem(itemId) =
{
bind( ...
"promotitle" -> SHtml.text(editablePromo.get.promotitle.is,
(s:String) => {
trace.logUIDataManipulation("Saving new promo Title["+s+"]");
editablePromo.get.promotitle(s)
}, "id" -> "promotitle"),
"save" -> SHtml.button("Save", ()=> {})
)
}
Then when the user selects an Item, and the editable Item form is plugged in, there's "another" submit button that should ajax submit the form data for that item, and then swap back in the (now updated) nonEditable version of the data.
The problem for me is the submission. In addition to the Edit Item form above, I've got a ajaxified submit button on the "parent" non-editable list page to handle submitting some fields below the list. The Edit Item "save"-> binding adds a button, which should do (and in fact does) nothing for itself, but it does trigger the "Parent" submit button. And I route that submit to do the save of the Edit Item form.
The non-editable Item and the editable item code swaps fine, but changes made in the editable Item form is not saved, and I figured out that that was happening because the elements in the editable Item form are not being submitted at all, following is an example of a log message I don't see at all...
bind( ... "promotitle" -> SHtml.text(editablePromo.get.promotitle.is,
(s:String) => {
trace.logUIDataManipulation("Saving new promo Title["+s+"]");
editablePromo.get.promotitle(s)
}, "id" -> "promotitle")
)
In a normal ajaxified form, all element handlers are called (if there are changes to the field, I guess...) in order of rendering, with the submit/hidden elements' handlers being called last (if they're last in the bind list.
so finally, let's get around to my question:
if you're doing in-place editing like this, how do I manage 2 submit buttons (the one for the non-editable list page plus the additional one that gets added when editing an item)?
I'm sure I don't need to refresh the page, but I can't figure out how you'd do this with Ajax.
Maybe alternatively, the in-place editable form can be submitted as a non-submit ajax action, ie. somehow that doesn't trigger the parent submit?
For anyone tripping over this question, I figured I'd share the solution I eventually found...
1)The problem was that the submit (for AJAX this is the hidden html tag) happened before the editable Item's field handlers were called. So when the AJAX update that collapsed the editable Item back into just a non-Editable list item, the data hadn't yet been updated. So what was displayed in non-editable form didn't show the update, yet if I refreshed the page in the browser, the update had been saved to the database and now showed properly.
2)The reason for the mal-ordering is that Lift assigns each form tag's server-side handler an id (which are "monotonically increasing" with an additional string added to the end). That's fine until you do an ajax live-update of a form and add fields (as I did when I inserted the Editable Item fields). These newly-added fields were assigned server-side ids that came after the hidden field that got generated as part of the initial page rendering.
3)The solution was to explicitly shove the hidden field into a much higher id using S.formGroup. See here for more details...
The example from the last link below is as follows (and differs from mine in that it uses SHtml.submit, whereas I use SHtml.hidden). It adds the constant 1,000 to the submit button's server-side handler id:
"type=submit" #> S.formGroup(1000) {
SHtml.submit("Submit", process)
}
Discussion of a problem that is essentially the same as mine: https://groups.google.com/forum/#!topic/liftweb/MYJQeVlOYFM
Description of id assignment and S.formGroup under heading "Server side function order.":
https://www.assembla.com/spaces/liftweb/wiki/cool_tips
And lastly, linked to from the last link is some example code:
https://groups.google.com/forum/#!topic/liftweb/E9z7PVhogQw

display 2nd form depending on 1st form result

I have two form in the same Tapestry page's:
First one is composed of :
select
submit button.
If there is a valid result I display it.
Otherwise I want to display the 2nd form wich is composed of :
4 textfields
1 submit button
So the 2nd must not be displayed first time, but only in case of empty result from the 1st one.
First off: Please share what you have tried so far.
Second: You can do this in a number of ways. The easiest is just to use a
<form>
<t:if test="showFirstForm">
....your 1st form content ....
<p:else>
....your 2nd form content ....
<p:else>
</t:if>
</form>
You might also like to have a look at the FormFragment for ajax controlled dynamic form content using triggers to redraw.

Grouping Form Zend not posting Data of Second Form?

I have 2 Forms, which I am usingain another form to try and keep things DRY.
In this manner:
#Forms/my_form.php
$this->addSubForm(new Form_thisForm(), 'this form');
$this->addSubForm(new Form_thatForm(), 'that form');
//then i add 2 more elements a sort and order element
//then a submit
So in the view where the form is used, all the fields show from all forms included.
However when posting the form data only the fields from Form_thisForm() and the Form_myForm(), ie. the main form, are posting. Data or form element names are not posting from Form_thatForm().
The post only contains variables in the 1st subform and full form. Not the second subform.
I guess your Form_thisForm and Form_thatForm are inherited from Zend_Form, so they also have Form decorator (which basically wraps your subforms in <form> tag).
As a result you have nested <form> tags in your html and this is not valid.
You should inherit your subforms classes from Zend_Form_SubForm - it has no Form decorator by default.

Zend Form dynamic row number with javascript

I have a form here in which there is a textfield which contains a number. In another part of the form there are rows, which coresponds with the number entered. For example 2 = 2 rows etc.
So my idea is to create one row which is duplicated by a javascript. So i must create a input element which name is in a array like name="input[]" how can i do this in Zend Framework?
The only approach i found for this kind of problem is to use subforms. But every Subform has a explicite name which is not in a array.
To make a rendered Zend_Form respond to client-side changes - as in your example, to allow the user to enter the number of rows he wants - you need both client-side and server-handling.
The best example demonstrating the general idea is from Jeremy Kendall:
jeremykendall.net » Blog Archive » Dynamically Adding Elements to Zend_Form
The upshot is that you have client-side code that adds tracks the number of fields and then a preValidation() method that injects the right number of fields into the $form instance before isValid() gets called.
[As noted in the comments there, this preValidation() processing could just be bundled into isValid() so that the controller remains unchanged.]