//Check if the user has pressed the modify button
//If Yes modify the contact information and update the contact table
if form(ModifyContact)
if form(txtfirstname)
//open the an instance of the contatcttype table for modifying data
table contacts=contacts.contacts
//moving pointer to selected record
contacts(recordno)=form(HdnRecPointer)
//assgin all the input values to respective fields.
contacts(Company)=form(TxtCompanyName)
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)
// modify the record
contacts(modify)
//Check if the records was succesfully inserted
if contacts(recordno)>"0"
"
Contact modified succesfully
"
else
"
Error occured while modifying record !!
"
endif
else
//Give an error messsage to the user
"
Contact First name cannot be Empty
"
endif
//end further execution
over
endif
// Check if user has pressed delete button
// if yes validate and delete record from contacts table.
if form(DeleteContact)
if form(txtfirstname)
//open the an instance of the contatcttype table for deleting data
table contacts_delete=contacts.contacts
//assgin all the input values to respective fields.
//moving pointer to selected record
contacts_delete(recordno)=form(HdnRecPointer)
// delete the record
contacts_delete(deleterecord)
//Check if the records was succesfully deleted
if contacts_delete(recordno)>"0"
"
Contact deleted succesfully
"
else
"
Error occured while deleting record !!
"
endif
endif
//end further execution
over
endif
include sample_top.html
Caravan
Business Server>Examples>Date & Time Variables
Modify/Delete Information
Select
Company name
// -- Combo Box For First & Last Name -----
// Here we are displaying first name and last name for selected company
// -- if contact person is selected
if form(cmbName)
// -- opening the instance of contacts table
// -- to get all informations of selected contact
// -- person.
table show_contactdetails=contacts.contacts
// -- taking record pointer to selected record.
show_contactdetails(recordno)=form(cmbName)
First Name
Last Name
else
// -- After selecting company name, we are displaying all
// -- available persons first name and last name combined
// -- in combo.
table disp_contacts=contacts.contacts
if form(txtCompanyID)
delete sql
var sql
sql(company_no)=form(txtCompanyID)
select * from disp_contacts where Company="{company_no}"
endif
First Name + Last Name