Thanks Khalil for providing solution with example..I will write as per
below instruction and let you know the result.

Thanks once again :)

Amit

On Wed, Aug 22, 2012 at 11:42 AM, Khalil KHAMLICHI <
[email protected]> wrote:

> 1) controller page1: controllers/default.py
>
> def page1:
> return dict()
>
> 2) view page1: views/default/page1.html
>
> page1.html content :
>
> <form name="text_form" action="page2.html" method="get">
>  Please Enter ID: <input type="text" name="EneteredID" />
> <input type="submit" value="Submit" />
> </form>
>
> 3) controller page2: controllers/default.py
>
> def page2():
> EnteredID = request.vars['EnteredID']
> # 1 - check if record exists
> record = db(db.YourTableNameHere.ID == EnteredID).select()[0]
> if len(record):
> # 2 insert it into a second table
> db(db.SecondTableName).insert(field1=record.field1, field2=record.field2,
> field3=record.field3 )
> return dict( result='Success' )
> else:
> return dict( result='Record Not Found')
>
> I believe you can build on top of this.
>
>
>
> On Wed, Aug 22, 2012 at 6:52 AM, Amit <[email protected]> wrote:
>
>> Hi,
>> I generated one custom html file which is having one text field where
>> user has to enter id and one submit button.
>>
>> I have to use it in following manner:
>> 1. User has to enter the id and press the submit button
>> 2. after pressing submit button, id value has to be validated in xyz
>> table.
>> 3. first it has to validate whether entered id is available in xyz table
>> or not, if not available then it has to notify the user about it
>> 4. if id is available in xyz table then it will fetch the record of id
>> from xyz table and insert it to another table called abc table.
>>
>> problem facing:
>> I have to add this html to my web2py project and achieve the above
>> functionality  , Can anybody help me to provide the solution how to use
>> custom html and database interaction with it?
>>
>> --
>>
>>
>>
>>
>
>  --
>
>
>
>

-- 



Reply via email to