import gluon.contrib.simplejson as json
from gluon.serializers import xml
js_string="{'test':2}" # or other JS string
xml_string=xml(json.loads(js_string))
On Sep 16, 8:57 pm, Markus <[email protected]> wrote:
> I dont want to use Web2Py.
>
> I want to compute in JS, based on a HTML form input and generate an
> XML document.
>
> Is it possible to convert JS to XML?
>
> On Sep 16, 6:49 pm, Wes James <[email protected]> wrote:
>
> > On Wed, Sep 16, 2009 at 3:24 PM, Markus <[email protected]> wrote:
>
> > > Hello
>
> > > Say i have a HTML form that takes in values and stores in JS
> > > variables.
>
> > > Is it possible to convert the JS variables to an XML file.
>
> > > Example:
>
> > I don't understand why you want to save the JS variables.
>
> > In web2py in your controller
> > form=FORM(TABLE(
> > TR(TD('Name, _align='right'),
> > INPUT(_name='name,requires=IS_NOT_EMPTY())),
> > TR(TD('Salary', _align='right'),
> > INPUT(_name='Salary', requires=IS_NOT_EMPTY())),
> > TR(TD('tax on salary', _align='right'),
> > INPUT(_name='saltax', requires=IS_NOT_EMPTY())),
> > TR('',TD(INPUT(_type='submit'), _align='center'))
> > )
> > )
> > if form.accepts(request.vars,session):
> > f = open('file_path', 'w')
> > print f "<Name>" + form.vars.name + "</Name>
>
> > <Salary>" + form.vars.salary + "</Salary>
>
> > <tax on salary>" + form.vars.saltax + "</tax on salary>"
>
> > -------------------------
>
> > Not sure what you want to do exactly though.
>
> > -wes
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---