Hi,
I hope you're having a good one ;).
I've some code;
*db.py*
*db.define_table('Customers',Field('customer_number','integer',unique=True,notnull=True,required=True),Field('first_name','string'),Field('family_name','string'),Field('flat_number','integer'),Field('street_number','integer'),Field('street_name','string'),Field('suburb_name','string'),Field('state_name','string'),Field('postcode','integer'),Field('phone_number','string'))*
default.py
def E_purchase():
mycustomernumber = session.customernumber
mycustomerdetails =db(db.Customers.customer_number==mycustomernumber).select
()
return dict(customername =mycustomerdetails[0]['first_name'])
E_purchase.html
#returns customer number correctly.
<p>{{=customername}}<p>
# returns nothing, no alert triggered.
<script type="text/javascript">
var x = {{=customername}};
alert(x)
</script>
If its a standard int or string the alert will trigger with the correct
values, however considering its a value from a table it will not recognize
{{=customer}} as a value.
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.