In web2py, you create a form like:
form = SQLFORM(db.mytable).process()
In that case, form is the HTML helper object. You would then do something
like:
form.elements('input')
to find all input elements within the form.
Anthony
On Monday, December 24, 2012 10:46:55 PM UTC-5, Bhaskar Ramachandran wrote:
>
> I am new to web2py and wondering how i can manipulate elements in a form.
> This form is in the view file with the form tags all hand coded in html
> without using the web2py helpers.
> Now when an user submits this form, i would like to make some decisions
> based on the user posted information (I could understand how to do this) by
> writing python code in controller. And then i want to change some of the
> elements in the form.
> For example, i want to disable all radio buttons in the form and want to
> change some text color in the form.
>
> I see that there is a .element() and .elements() functions to do DOM
> searching. But on what object will i do this search ?. What is the handle
> for the DOM tree structure ?. Is there an object created in memory for my
> form when the user submits the form ?. What will be this objects name.
> It doesn't seem to be same as my form name. I tried a few things and they
> didn't work.
>
> I think in javascript, the client side DOM is accessed as
> document.getElementbyID(...). Similarly, like the document object, what is
> the name of the object that represents the entire html page and the object
> that represents the form within in the server side ?
>
> Thanks in advance...
> --Bhaskar
>
>
--