Zend form application - forms

Im writing a program in zend using zend forms. Everything is fine the form process well to the database but the problem is that the form is too long +-50 inputs which all belong to one database table. How can I find a way to shorten/break some parts of the form to fill in first and then use a next link to fill the rest, bit by bit, and then a finish link to process the form to the database. Basically break the form in parts so that the user wont give up easily or become lazy while filling in his/her details. Can I use multipage form if so, how can I go about it?
Thanks in advance

Use Sub forms for each step (page). See this example - http://framework.zend.com/manual/1.12/en/zend.form.advanced.html#zend.form.advanced.multiPage

As each step will probably contain its own validation, I suppose that the best approach would be to write a separate form for each step in the wizard. After successful validation of one form, store the results in the session and proceed to the next step.

Related

SYMFONY FORM - filter attribute form on top with submit button, that provides a table with other form used to edit each row details

I am looking for best practices on SYMFONY FORM handling to achieve the following standard page (surprisingly I haven't found anything similar existing yet on SO).
Here is a shema of what I want to achieve:
As you can see at the top there is a SYMFONY FORM to filter the results that should be displayed.
It displays a table and each tuple of the table should permit to open another SYMFONY FORM kind linked to the tuple.
I am in the process of learning SYMFONY FORM, so far, I can manage to create the top row FORM to set the filter that'll apply to the table display.
But I wonder if anyone has experience on the second part: Displaying the table that embed as well many forms of a similar kind -That seems a bit more complex. I read about TWIG.EXTENSION and FORM.COLLECTION, I'll investigate that. But if someone could save me to re-invent the wheel and lead me to some direct shortcut, I'd be really grateful.
No idea if it's the best practice, but one way to do it would be to create a new property for your entity being listed in this table, called $editionForm (without mapping it to the database) for example.
Then, either throught a custom loop or by listening to a doctrine (or any ORM you use) hydration event (or triggering such an event if you don't use any ORM), fill the property with the generated form, probably within a dedicated service.
Then, just use it in your template like this :
$entity->getEditionForm()->render()

Multistep forms using CodeIgniter

I am trying to build a multistep form with CodeIgniter,but I cant figure it out how it should be.My thoughts are to create for each step different contoller functions and views. Is my thought right or is there any better way to implement it?
Do you recommend to create the fomrs using AJAX?
Thank you in advance.
For youe problem i can suggest two solutions.
It is up to you either you use ajax or form post.
Method 1
1.One first setp save the data to table
2.In the second and all other steps update the table.
If you are going to give back functionality you will
have to work carefully and make sure your form code has
primary key when at least step one has passed through.
Method 2
In this method do not save in the table just through
each form post to session and when the final step is
passed through you can save the data to table from session
once and for all

Simulate Form Submit with Symfony 2

I'm working with Symfony 2 and need some advice.
I have a Controller, which gets a form-request and searches the database for matches and renders the results (so it's just a basic search).
Now I would like to redirect to this controller but without coming from a form.
To be more specific:
I'm on the search-page, fill out the form and hit the search button -> I get results for my search.
I'm somewhere else and want to delete a labelCategory of a book -> If some books still use this labelCategory, I want to get search results for this labelCategory.
My only idea so far is, to simulate the form submit somehow, but I didn't find out how to do it.
I'd be happy for every help of you ;)
You don't need form submit at all. Just put logic of searching to separate class. Than you can it in any controller you want. Maybe Service Container doc can help to

ACCESS 2010 Navigation Form Query Property

I'm coming accross a problem and i have searched the entire World Wide Web:
I have a Navigation form which has forms in it.
Those forms are used to give properties to my queries.
For example:
FormStatus-->Ask user to select the status and shoot the value to the query.
These queries build reports.
The main problem is that now that my form is in a navigation form, the link for the property is no longer working.
The link used to be : Forms!myForm!myProperty
Now i tried
Forms!navigationForm!myForm!myProperty
Me!myForm!myProperty
Forms!ParentForm!SubForm.Form!FieldName
Nothing works out!! Can anybody help me?
As a general approach to filtering forms or reports, as you can see placing forms! references inside of forms becomes a rather messy business real fast here.
You are best to remove the forms! references from ALL your queries. You then build a form that the user enter the values into, and then execute a browseto command.
The problem you are experiencing here is that the new navigation form swaps out a given form for a new form. This means that the old form is NOT loaded anymore. So, either you
Plan A
Dump use of forms! commands in your SQL queries. This is a good idea anyway since then one query will not blow up because some silly form is not open. And more important the query can be used in other places in the application without fear of some form not being opened.
The instant you place a forms! reference inside of a query is the instant you ruin that query and force "marry" that query to one form that must be opened.
Plan b:
Dump the use of the new navigation control system. Just remember, the new navigation system does NOT load the next form, but "replaces" the one that is being displayed. Thus the previous form is not going to be loaded anymore and thus no forms! ref is allowed. Worse, since the navigation form is really using sub-forms, then the forms! references have to be changed.
You can certainly grab the values of controls and build a where clause in code and use that for openform or open report commands here.
Last but not least, if you in for lots of continued torture, you can stick with your poor design you have now and simply re-edit and fix all of the forms! references to reflect that they are now being used inside of a parent form, and all of your forms are now in effect being run as sub forms.
Try using a dot instead of ! before the property Forms!navigationForm!myForm.myProperty

step by step problem with validation on "back" button

I have a 3 steps forms where I bind for each step on a ViewModel that has DataAnnotation. Everything works fine except that when I click on my "previous" button, the validation gets called and, if there's missing values, the user has to fill all required fields. If I go with an action link, then the data won't be persisted. What I'm looking for here is a way to save my values without calling the validation. I also consider using cookies but I don't think that it's the best way of doing it.
Any ideas or suggestions?
I use separate models for each step of my wizard pages. I also make sure that the previous clicks do not hit ModelState.IsValid which is what triggers the validation check.
I store the results of each step using session state stored in SQL Server. You can also use hidden variables but I didn't like that solution.
Add a comment if you need more detail or show some code for us to see.
Ok after lots of searching I found out a solution for having a Wizard like multiple forms with previous and next buttons that won't call the client validation from Data Annotation and MicrosoftMvcValidation.js. I found this post : jQuery Validation plugin: disable validation for specified submit buttons witch simply add a class to the submit button but it was not working for me so I look again and found this one : http://forums.asp.net/p/1622628/4165648.aspx witch has a solution working for me in javascript : document.getElementById("someButton").disableValidation = true; I would prefer a jQuery solution so I could do something with the class attribute of my buttons but it's working for today and I've spent too mutch time on this.
Hope it helps some else who's trying to do a "Cancel" button or a Wizard like forms in MVC2 and want's to post the form to the controller so he needs to clear the validation.