On Jul 1, 4:07 pm, mdipierro <[email protected]> wrote:
> Interesting. we should be able to support something like this. Can you
> post some examples. I cannot find any on the docs.

I'm working from:
http://code.javarosa.org/wiki/buildxforms
(This has example forms)

So for a simple model:
db.define_table(budget_item,
                db.Field('code', notnull=True, unique=True),
                db.Field('description', length=256, notnull=True),
                db.Field('cost_type', notnull=True))
db[table].code.requires = IS_NOT_EMPTY()
db[table].description.requires = IS_NOT_EMPTY()
db[table].cost_type.requires = IS_IN_SET(['One-time', 'Recurring'])

I get:
<h:html xmlns="http://www.w3.org/2002/xforms";
        xmlns:h="http://www.w3.org/1999/xhtml";
        xmlns:ev="http://www.w3.org/2001/xml-events";
        xmlns:xsd="http://www.w3.org/2001/XMLSchema";
        xmlns:jr="http://openrosa.org/javarosa";>
  <h:head>
    <h:title>Budget Item</h:title>
    <model>
      <instance>
        <item xmlns="">
            <code />
            <description />
            <cost_type />
        </item>
      </instance>
      <bind nodeset="code" required="true()" />
      <bind nodeset="description" required="true()" />
    </model>
  </h:head>
  <h:body>
    <input ref="code">
        <label>Code:</label>
    </input>
    <input ref="description">
        <label>Description:</label>
    </input>
    <select1 ref="cost_type">
        <label>Cost Type:</label>
        <item>
            <label>One-time</label>
            <value>One-time</value>
        </item>
        <item>
            <label>Recurring</label>
            <value>Recurring</value>
        </item>
    </select1>
  </h:body>
</h:html>

Glad that you're interested :)

F

> MAssimo
>
> On Jul 1, 8:42 am, Fran <[email protected]> wrote:
>
> > I would like to be able to make use of JavaRosa[1] to input data on a
> > J2ME handheld & pass to a back-end Web2Py server.
> > This requires the creation of XForms[2] on the handheld.
> > It seems like it should be /reasonably/ easy to write an equivalent of
> > sqlhtml.py to auto-generate these from the Model.
> > I don't suppose anyone else has done some work on this already or
> > would be interested in contributing to it?
>
> > [1]http://code.javarosa.org/
> > [2]http://en.wikipedia.org/wiki/XFormshttp://oreilly.com/catalog/9780596...
>
> > Many thanks,
> > Fran.
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to