Hi qooxdooers,

i got a simple question, maybe it was answered before but i cannot find it.

I got a json from php like this one:

{"sitename":"Hotel Lariana","footer":"Hotel Lariana - via Bergamo,9 47900
Rivazzurra di Rimini - P.IVA 03652540406","keywords":"hotel, rimini,
rivazzurra, mare, offerte, pensione, albergo, sconti, fiera wellness,
viserba, sole, sabbia, lariana, fiabilandia, aquafan, riccione, romagna,
festa streghe, eventi, italia in miniatura, miramare, bellariva, vacanza,
vacanze, soggiorno, relax, divertimento, discoteche, cocoric\u00f2, carnaby,
peterpan","description":"Hotel Lariana, in via Bergamo, aperto da Maggio a
Settembre, ambiente familiare, cordialit\u00e0 ed ospitalit\u00e0."}

And i got a model created from a form controller where the properties have
the same name like the ones returned by the model.

And i want to set the forms fields "dynamically" instead of doing like this:

if(content.sitename) model.setSitename(content.sitename);
if(content.footer) model.setFooter(content.footer);
if(content.credits) model.setCredits(content.credits);
if(content.keywords) model.setKeywords(content.keywords);
if(content.description) model.setDescription(content.description);
if(content.analytics) model.setAnalytics(content.analytics);

Using like a loop where i check the keys of both models and assign and add
the value only if it is not null.

-----
La coincidenza non ha madre.
--
View this message in context: 
http://qooxdoo.678.n2.nabble.com/Set-properties-dinamically-from-json-to-form-model-tp6358957p6358957.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to