Hi ,
I have one specific problem in grid UI which describes below:
I am having one table called “device_config_info”:
db.define_table(
*'device_config_info'*,
*Field(**'mac_id'**,requires=IS_NOT_EMPTY(),readable=**True*
*,writable=**False**),***
*Field*(*'serial_no'*,requires=*IS_NOT_EMPTY*()),
*Field*(*'name'*,requires=*IS_NOT_EMPTY*()),
*Field*(*'email_ids'*,*'text'*,requires=*IS_NOT_EMPTY*())
))
And corresponding controller function which will generates grid view:
*@auth.requires_login*()
def device():
mac_id=*get_mac_id*(*auth*.user.email)
query=(*db*.device_config_info.mac_id == mac_id)
grid = *SQLFORM*.grid(query)
return locals()
Here, get_mac_id() function will return the gateway mac id registered for
the logged-in user.
This function will lists all devices info which are registered by a
particular user,and we can see set of buttons like View,Edit,Delete,Add
etc… and upon clicking on these buttons, everything is working as expected
except Add button.
When I click on Add button it displays Screen with all fields of
device_config_info table where user can fill the info and create new record
but here I am facing problem regarding mac_id.
In this screen, problem is Mac Id is displaying as “None”, please note that
This field is disabled on UI and on database level it has made as Writable
= False. I want to display the mac id for the user who has currently logged
in, so how can I pass and display mac id on the screen upon click of Add
button on the Grid view?Means, when user clicks on Add button on grid view
,somehow I need to display the mac_id to the mac_id field of Add screen.
Second problem is : How can I make “Email Ids” field to accept only email
ids and maximum number of email ids should be allowed to enter is 5?
Please help me resolve this issue.
Regards,
Amit
--