Hi Anthony,

    In my case, the form is displaying question, image and 4 choices from a 
database. Since the database has many other information like answers etc, i 
decided to customize the form completely by handcoding the html. In between 
the html, i am having statements like {{=db.quiz[1].Achoice}} to inject 
data from the database.
Now, when the user enters a choice by selecting a radio button and submits 
the form, I want to navigate the DOM. There is no statement like 
form=SQLFORM(...) or form=FORM(....) etc in my controller. So how should i 
now do the DOM parsing ?

Regards,
Bhaskar


On Monday, December 24, 2012 10:18:53 PM UTC-6, Anthony wrote:
>
> 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
>>
>>

-- 



Reply via email to