This might be sort of an easy question so I apologize. I am making
an application where the user selects from a drop down list of template
messages and then the program sends a text where the message body depends
on what item was selected from the drop down. I.e If I selected 6 from the
drop down list the message would send string "update" or if it selected 3
it might send the word "lock".
This is relationship is defined in a Table and then called in a
field in a separate table. So there are two tables, one that has the
Message type and the corresponding word as fields, and then Table 2 which
is displayed for the user to enter information in, has a field that calls
IS_IN_DB to the message type in Field 1.
My problem is I can't seem to figure out how to send a message that
sends the corresponding word based on which message type the user selects
from the drop down. I tried reading about validators and the database
abstraction layer but I didn't find anything that would really help me.
The code is here but it doesn't quite work.
@auth.requires_login()
def send_message():
form1=SQLFORM(db.t_sms, fields=['f_service','f_messagevar1'])
form2=SQLFORM(db.t_sms, fields=['f_service','f_messagevar2'])
if request.vars.f_service:
servicetype1 =
db(db.t_messagetype.id==request.vars.f_service).select().f_servicenumber
if form1.process(formname='form_one').accepted:
session.flash = 'form accepted'
account = "account number"
token = "token number"
client = TwilioRestClient(account, token)
message = client.sms.messages.create(to="+to phone number",
from_="from phone number",
body= 'Service' + ' ' +
str(form1.vars.f_messagevar1) + ' ' + str(servicetype1)
--
---
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/groups/opt_out.