//Check if the user has pressed the submit button
//If Yes validate and insert the contact information and update the contact table
if form(AddContact)
if form(txtfirstname)
//open the an instance of the contatcttype table for inserting data
table contacts=contacts.contacts
//Check if the contact exists
select from contacts where Company={txtCompanyID} and FirstName="{txtFirstName}" and Lastname="{txtLastname}"
if contacts(selected)>"0"
"Contact person already exist
"
over
endif
//assgin all the input values to respective fields.
contacts(Company)=form(txtCompanyID)
contacts(firstname)=form(txtfirstname)
contacts(lastname)=form(txtlastname)
contacts(title)=form(txttitle)
contacts(delim)=","
contacts(Workphone)=form(txtphone)
contacts(delim)="null"
contacts(homephone)=form(txthomephone)
contacts(mobilephone)=form(txtmobilephone)
contacts(Faxnumber)=form(txtfaxnumber)
contacts(EmailAddress)=form(txtemailaddress)
contacts(contacttype)=form(txtContactID)
// insert the record
contacts(insert)
//Check if the records was succesfully inserted
if contacts(recordno)>"0"
"Contact added succesfully
"
else
"Error occured while inserting record !!
"
endif
else
//Give an error messsage to the user
"Contact First name cannot be Empty
"
endif
//end further execution
over
endif
include sample_top.html
Caravan
Business Server>Examples>Date & Time Variables |
|
|
|
include sample_bottom.html