Building a dynamic form using PHP - php

I have a laravel based admin.
I'm looking for a PHP library which will help me to build dynamic forms.
By dynamic forms - I mean for example, when the user checks a radio button - new options will appear.
I can build one form using the basic laravel form builder and jQuery.
The thing is - I may have hundreds of such forms, I don't want to build each one of them manually.
Storing them in some kind of model which will be translated to a form is what I'm looking for.
Can you think of a PHP lib which will help me to achieve what I'm looking for?
Are there any other practices ?
All the form builders I've found are good for basic static forms.
Many thanks.
Amir

This is not done by PHP. This is work for JavaScript because you don't want to reload page with every click. You can use some framework like AngularJS or simple AJAX.
AJAX tutorial : http://www.w3schools.com/ajax/
AngularJS tutorial: http://www.w3schools.com/angular/

Related

Using AJAX code inside a Joomla article

How to add AJAX code inside a Joomla article by using a third party module like Flexi Custom Code?
I have a form inside my article and want to make a submit for this form without refreshing the page.
I read some pages talking about this, but I did not understand how to.
We have written an exhaustive and easy to use guide on how to use Ajax in Joomla. You can find it here.
In short, you will need to create a function ending by "Ajax" in the module in question that will check for the submitted information and that will return an output according to the submitted information. A valid function name can be funcAjax. Just make sure you pass "func" as the "method" in the ajax URL call.
You can use free extension like sourcerer Using this plugin, you can very easily insert html and javascript codes inside article.
here is a video tutorial on how to use it. https://www.youtube.com/watch?v=LiFa1Jq8igQ

Multiple Language support in Google form

Using Google form i created a survey form and collects data to the spreadsheet. I would like to use this form in different languages(Internationalisation). Google form support multiple language in one form?
any methods for this?
Thanks
google forms do not support this. there is a 3rd party tool to customize the form further but i doubt it can accomplish it. http://sneakysheep.com/google-docs-form-tool-version-2/
This is no ideal, but if you just want one other language, you can use the "Help Text" for the other language.

jquery mobile form: pass data in a form

I read on the web many things about creating form in jquery mobile and I didn't understand one thing. When I create a form and I would pass data through php, I hear jquery mobile serialize them and automatically pass over and if the form has been created using post method I can use them in an other page only using _POST array and nothing all. But I read also some people like it form with ajax use ajax to pass variable. So I didn't understand why use ajax?
The default for the jQuery Mobile framework is to submit forms via HTTP POST. Why? because then your web application has greater control over the UI when animating through pages, creating a smooth transition. Well, a better description can be found in the jqm docs here.
If you are looking to disable the default Ajax functionality, just append this to your form element:
data-ajax="false"
Hope this helps!

How to dynamically change data in the HTML textarea or text field with php?

I will have a web-application which will use a few complex forms. One form will have examples field on the top and field for user on the bottom. There will be approximately 10 examples. It will be great if i can change text and images without reloading full HTML page.
Form will be based on HTML. Php will do all logic processes. I haven't find information about HTML button - can i use it for this problem or i need just several submit buttons in the form?
How can i implement this using HTML and PHP?
Thanks in advance.
You can't do this with PHP alone, because it runs server-side and would force you to reload the page.
This is usually a job for Ajax, which is a technique to make JavaScript-based calls to URLs without reloading the current page.
The jQuery framework has one of the most popular and straightforward Ajax implementations.

To change template through Ajax in Symfony

there are two templates i am using for view and edit(is having the form to update),
the view will contain edit(link or button), on clicking the edit button i want that the edit template should be loaded (using Ajax, without refreshing the page).
and after editing it should be redirected to view again (using ajax same as above).
is there any code or method to do that? please help me...
You can replace your whole content DIV with the result of the AJAX call. In the controller, check if the request is a XMLHTTP request. If so, only return the template without the layout around it.
So you don't change the template, you are just fetching the result of an action via AJAX.
Hava a look the documentation integrating AJAX.
You should also consider in-place editing if it'll fit into your design.
I think in-place-edit is best option here. I have used jeditable and jQuery in symfony to achieve similar functionality. Please have a look at http://myimalert.com/stock_alerts
I could not find native support for in-place-edit in Symfony 1.4.

Categories