>
> I am getting an error with this stating:
form=FORM(TABLE(TR("Departure Location: ", INPUT(_type="text",
_name="DepartureLocation", IS_IN_SET(states))))), TR("Arrival Location: ",
INPUT(_type="text", _name="ArrivalLocation", IS_IN_SET(states))), TR("",
INPUT(_type="submit", _value="Submit"))
> SyntaxError: non-keyword arg after keyword arg
>
>
In your INPUT elements, you first include two keyword arguments (_type and
_name), and then you include a positional argument (the IS_IN_SET
validators), which is not allowed in Python. Positional arguments must come
before keyword arguments. Furthermore, the validator in INPUT is not a
positional argument anyway -- it is a keyword argument (the keyword is
"requires") -- so it should be:
INPUT(_type="text", _name="ArrivalLocation", requires=IS_IN_SET(states))
Anyway, I would instead recommend using SQLFORM to create and process the
form, as it will handle everything based on your table definition. Just be
sure to avoid doing a database insert when a query is submitted. To prevent
the insert, you can either use the .validate() method (which by default
doesn't do an insert) or use .process(..., dbio=False).
Anthony
--