function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sushmaiyer2@gmail.comsushmaiyer2@gmail.com 

Can someone please help me with converting the Following S-control into VF Code

Hi All,

Can someone please help me with converting the Following S-control into VF Code :-

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Edit Address Information</title>
<link href="/dCSS/Theme2/default/common.css" type="text/css" media="handheld,print,projection,screen,tty,tv" rel="stylesheet" >
<script src="/soap/ajax/9.0/connection.js"></script>
<script type="text/javascript">
var picklistFieldPrefixes = new Array("Mailing");
var record = new sforce.SObject("Lead");
var mailing = null;
</script>
{!INCLUDE($SControl.Address_Edit)}
<script type="text/javascript">
// Saves the address form data to the lead
function saveAddress(form, saveAndNew) {
try {
var recordId = "{!Lead.Id}";
// Set Address fields
setField(document.getElementById("Street"));
setField(document.getElementById("City"));
setField(document.getElementById("MailingState"),"State");
setField(document.getElementById("PostalCode"));
setField(document.getElementById("MailingCountry"),"Country");
record.set("Id",recordId);
record.fieldsToNull = fieldsToNull
var saveResult = sforce.connection.update([record]);
if (!saveResult[0].success) {
throw updateError(getErrorString(saveResult[0].errors));
}

if (saveAndNew) {
opener.location.href = "/00Q/e?retURL=%2F00Q%2Fo";
} else {
opener.location.reload();
}
window.close();
return true;
}
catch (e) {
exceptionHandler(e);
}
}
function init() {
try {
mailing = new DynamicOptionList("mailingCountry","mailingState");
}
catch(e) {
exceptionHandler(e);
}
}
function popPicklistCurrentAddress() {
try {
// Check if lead currently contains a state / country and pre-set picklists

var currentCountry = "{!Lead.Country}";

setSelected(document.addressForm.mailingCountry,currentCountry);

var currentState = "{!Lead.State}";

mailing.forValue("{!Lead.Country}").setDefaultOptions(currentState);
}
catch(e) {
exceptionHandler(e);
}
}
</script>
</head>
<body class="lead detailPage" onLoad="initDynamicOptionLists();">
<form name="addressForm" id="addressForm">
<table class="outer" width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="oRight">
<div class="bPageBlock secondaryPalette">
<div class="pbBody">
<div class="pbSubheader tertiaryPalette">
<h3>{!Lead.Name} - Address Information</h3></div>
<div class="pbSubsection">
<TABLE class="detailList" cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="labelCol"><label for="Street">Address</label></td>
<td class="dataCol col02"><textarea cols="27" rows="2" tabindex="1" maxlength="255" type="text" wrap="soft" id="Street" name="Street">{!Lead.Street}</textarea></td>
</tr>
<tr>
<td class="labelCol"><span id="lblOrgId">City</span></td>
<TD class="dataCol col02"><input value="{!Lead.City}" tabindex="2" maxlength="40" type="text" id="City" size="20" name="City"></TD>
</tr>
<tr>
<td class="labelCol">Country</td>
<TD class="dataCol col02">
<select tabindex="3" selected="{!Lead.Country}" id="MailingCountry" name="mailingCountry" ></select>
</td>
</tr>
<tr>
<td class="labelCol">State</td>
<td class="dataCol col02"><select tabindex="4" selected="{!Lead.State}" id="MailingState" name="mailingState" ></select></td>
</tr>
<tr>
<td class="labelCol">Zip/Postal Code</td>
<TD class="dataCol col02 last"><input value="{!Lead.PostalCode}" tabindex="5" maxlength="20" type="text" id="PostalCode" name="PostalCode" size="20" name="Zip"></TD>
</tr>
</table>
</div>
</div>
<div class="pbBottomButtons"><TABLE cellpadding="0" cellspacing="0" border="0"><TR><TD class="pbTitle" align="center"><img src="/s.gif" alt="" title="" width=1 height=1 class="minWidth">&nbsp;</TD><TD class="pbButtonb"><input value=" Save " class="btn" tabindex="11" type="button" title="Save" name="save" onClick="saveAddress(this.form, false);">&nbsp;<input value=" Save & New " class="btn" tabindex="12" type="button" title="Save & New" name="saveNew" onClick="saveAddress(this.form, true);">&nbsp;<input value="Cancel" class="btn" tabindex="13" type="button" title="Cancel" name="cancel" onClick="window.close();"></TD></TR></TABLE></div>
<div class="pbFooter secondaryPalette"><div class="bg"></div></div>
</div>
</td>
</tr>
</table>
<!-- Now that form has been rendered, build out the picklists -->
<script type="text/javascript">
init();
buildPicklists();
popPicklistCurrentAddress();
</script>
</form>
</body>
</html>