Calendar View List View Reports Add New Edit Delete Attach Files... | Previous Next
id:
9

Reply:

There are some javascript functions available to do things like this:

function updateValue(table,field,id,value)
updateValue will update a field for a specific record with a specified value.
table - The name of the table containing the item to update
field - The field or column name to update
id - The id field of the record to update
value - The new value for the field

function updateValues(table,field,value,valuename)
updateValues will update a field on many records specified with checkboxes named ID. Each of the items checked will have their field updated to value. If the column is a foreign key ID that is numeric, valuename will be the text string to display in the confirmation box.
table - The name of the table containing the item to update
field - The field or column name to update
value - The new value for the field
valuename - Value name allows you to specify a name to display in the confirmation prompt.

function executeUrl(url)
If you want to construct a custom url to execute against the server and verify success of the operation, use executeUrl. If the operation is successful, EXECUTE_SUCCESS will be returned. Otherwise, a message indicating the reason the operation failed will be returned.

function getUrlString(url)
getUrlString returns the output of a particular url. This will allow you to embed content in a particular element on your page.


Example:

function shipOrder(id){
var el=document.getElementById('shipstatus');
var test = updateValue('orders','ReadyToShip',id,'Y');
if (test != EXECUTE_SUCCESS){
el.innerHTML="<span class=error>" + test + "</span>";
}else{
test = executeUrl('db.aspx?t=orders&o=SendOrderEmail&orderid=' + id);
if (test==EXECUTE_SUCCESS){
el.innerHTML="Order Sent to Warehouse for shipping. <a href='db.aspx?t=orders&vid=1&readytoship=Y&orderby=1,1&selectcolumns=id,OrdererName,Customer,ShiptoAddress,DeliveryType,createid,createdate,ordernumber&title=New+Orders'>Click to view order list</a>";
}else{
el.innerHTML="<span class='error'>Order submitted, but there was an error sending the email. Contact the warehouse to let them know an order is ready.</span>";
}
}
el = el.style;
el.background='beige';
el.border='solid 1px';
el.padding='1em';
}





createdate:
4/28/2008 1:02:00 PM

createid:
pj