Zend Forms or simple html forms - zend-framework

It is mandatory to use a Zend Form everytime I need one? Can I do it with a simple html form in my phtml?
Are there dangers or trouble using the html one?

You can still use pure html forms wherever you want.
Zend_Forms try to help to easily implement the best pratices particularly validating, filtering and escaping user input. If you use pure HTML, you may forget these best pratices.

Related

Is there / What is a suggested way to create autocompleted form fields in ZF2?

Does the ZF2 Form (zendframework/zend-form) provide a mechanism to create text fields with autocompleted value list? Or is it just done by using the common Zend\Form\Element\Text, a Controller, that provides the data, and some JavaScript (not by ZF generated, but implemented in any proper way)?
You can use jQuery Autocomplete field with Any Framework or CMS, You can grab it here. https://jqueryui.com/autocomplete/
Its quite simple and easy to use.
You can fill source array on document.ready() or on field.change() or on field.keypress() events as per your requirements using Ajax.
Or you can read similar Resolved issue here
JQuery UI Autocomplete with Zend Framework
Zend Form doesn't have such mechanism, so proper way is use AJAX request with JSON response. See Rob Allen's tutorial for this:
Returning JSON from a ZF2 controller action

How to define custom wicket tag

I could not find a wicket tag like wicket:include? Can anyone suggest me anything? I want to include/inject raw source into html files? If there is no such utility, any suggestions to develop it?
update
i am looking for sth like jsp:include. this inclusion is expected to be handled on the server side.
To do this, you'll need to implement your own IComponentResolver.
This blog article shows an example somewhat resembling what you're after.
Is it raw markup that you want to include, or Wicket content?
If it's raw markup, even a simple Label can do that for you. If you call setEscapeModelStrings( false), the string value of the model will be copied straight in the markup. (Watch out for potential XSS attacks though.)
"Including" Wicket markup is done via Panels (or occasionally Fragments)
Update: If you add more detail about the actual problem you need to solve, there's a good chance that we can find a more "wickety" solution, after all, JSP and Wicket are two different worlds and the mindset of one doesn't work very well in the other.

Spring form field id with dot doesn't work well with jquery

When I build a form I need to use a dots in path variable. When html is generated inputs has dots in ids. There is a problem with third party jquery plugins like validators. They doesn't work well with dots. Is there a way to change all dots into eg. "_".
One solution would be not to use automatic form binding, so instead of using <spring:form/> you might still use plain HTML tag <form> and handle it regular way. It all depends if you want to benefit from Spring's mechanisms like automatic form field binding and error handling. But if you are handling form validation with JavaScript and you plan to do it across the whole project, you might want to make that effort. What I usually do is to handle client side and server side validation with JavaScript (plain and AJAX), so I'm not using <spring:form/> at all.

form decorators in zend framework

I am new to zend framework. I have used zend form and decorators to make form using class and decorators. The form i created was simple register form.
Now my question is "Is it advisable to use zend form for many complex forms as well ?" i have made many complex forms full of jquery with lots of conditions.. so at this moment i feel that it will very much difficult to make such form using decorators.
The power of form is zend filters and zend validartios which saves our hell lot of time...
So can we make forms in our phtml files and still use the power of filters and validators or is dere any other way...???
Well, my opinion would be to try to make the forms using Zend Form. The reason is that time spent on making Zend_Forms, setting up decorators, customizing elements or creating your own elements will be saved once the form is in use. With Zend Form you get very easy and straightforward way of validating your form, filtering contents of your fields, managing error messages, translating it, etc. In addition, once you spent time on e.g. writing your own or customizing existing decorators, form view helpers, form elements, it will be quite easy just to take them and use them in your next ZF project.
So in my opinion, in the long term using Zend_Form will save you time, even if at the beginning it may seem that using Zend_Form causes more troubles and headaches than not using them.
But off course, if you want to make your forms directly in phtml there is nothing that stops you. Both Zend filters and validators can be used on their own, independently of Zend_Form. You could also create zend form that has the same elements and structure as your "phtml form". This way you could only populate the zend_form, and use it only for validation and filtering of submmited data, not for actual rendering of your form.

Why do we use HTML helper in ASP.NET MVC?

Are there any good thing, best practice or profit we have after using the HTML helper in an ASP.NET MVC project?
When I am trying to use them I found that I lose the speed I have with HTML and many difficulties I have whenever I use an HTML helper.
Other [non-techie] persons can't understand what I write using Helper if I want to show them or they want to do something they need to spent more time on, even if they have working knowledge of HTML.
If I use an HTML helper I lose the speed. When I use HTML I just type and of course I am not aware of it. But using helper, it is hard to understand.
What thing do we get when I use HTML helper? I think it is nothing I get because I lose the speeed. Others can't understand what I do using helper and can't customize the code if they want.
Why do we use HTML helpers?
You use HTML helpers to encapsulate some small HTML fragments which are repeated all over your pages. And to avoid writing those HTML snippets all over again you use helpers.
They are very useful, especially when dealing with things like URLs because instead of hardcoding your links helpers take advantage of routing the definition on your server and by simply changing those routes the whole site URLs' change without ever touching any single HTML page.
Another scenario where HTML helpers are useful is for generating form input fields. In this case they automatically could handle values when posting back and show associated validation messages. Can you imagine the spaghetti code you would have to write in your views if there weren't HTML helpers?
The biggest advantage I find is with the editor and display templates.
If your editor for a field is more than just a simple input box, you can put that into a template and replace the several tags with a call to
<%:Html.EditorFor(m=>m.Property)%>
This means that your page is a lot easier to edit as you aren't wading through a lot of fluff HTML to find what you want.