You need to sign in to do that
Don't have an account?
Cwestonr
Update custome fields from HTML form in s-control HELP!
I am trying to update some optional fields in Account via a popup HTML form.
here is the code I am trying to use I keep getting an error in the Salesforce connection javascript
here is the code I am trying to use I keep getting an error in the Salesforce connection javascript
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Test S-control</title> <script type="text/javascript" language="javascript" src="/js/functions.js"></script> <script type="text/javascript" src="/soap/ajax/10.0/connection.js"></script> <script type="text/javascript" > function Save_form() { //save the data from the form var recObject = new sforce.SObject("Account"); recObject.Id = "{!Account.Id}"; recObject.Cash_for_Capitol_Call_Notes__c = document.form.Cash_for_Capitol_Call_Notes.value; recObject.Cash_Held_for_Capitol_Calls__c = document.form.Cash_Held_for_Capitol_Calls.value; recObject.Client_Requested_Restrictions__c = document.form.Client_Requested_Restrictions.value; //recObject.Client_Restriction_Date__c = sforce.connection.getServerTimestamp(); var result = sforce.connection.update([recObject]); if (result[0].getBoolean("success")) { alert("Update worked "); self.close(); } else { alert("Faild with " + result[0] + ". "); } } </script> </head> <body> html form follows...
Thanks!
I'm not sure if they have a function for that (if they do let me know) but you can use Javascript regular expressions to remove the characters before you send the update. Something like this should work
function removeChars(value)
{
var charactersToRemove = /[$,]/ig;
var newValue = myText.replace(value,'');
return newValue;
}
Sorry, I slapped that together a little too quickly....here's what actually works.
function removeCharacters(value)
{
var charactersToRemove = /[$,]/ig;
var newValue = value.replace(charactersToRemove,'');
return newValue;
}