symfony1 - Symfony form widget custom rendering -


i looking way automate form output json format instead of html. using jquery dform http://plugins.jquery.com/project/dform create dynamic forms.

sample output:

{ "type" : "p", "html" : "you must login" }, { "name" : "username", "id" : "txt-username", "caption" : "username", "type" : "text", "placeholder" : "e.g. user@example.com" }, { "name" : "password", "caption" : "password", "type" : "password" }, { "type" : "submit", "value" : "login" }

please help

create renderjson method , attach baseform. method iterate through the sfformfields , build array pass json_encode.

an ideal solution inject own class sfwidgetform inheritance chain renderjson method individual widgets can control json format. unfortunately, symfony makes difficult do.


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -