copying billing address to shipping address java script with out controller....
<apex:page standardController="Account" showHeader="true" sidebar="true">
<apex:form id="myForm">
<script>
function copyAddress() {
var shippingStreet = document.getElementById('j_id0:myForm:pgBlock:pgBlockSectionAddressInfo:j_id58:actShippingStreet');
var shippingCity = document.getElementById('j_id0:myForm:pgBlock:pgBlockSectionAddressInfo:j_id64:actShippingCity');
var shippingState = document.getElementById('j_id0:myForm:pgBlock:pgBlockSectionAddressInfo:j_id70:actShippingState');
var shippingCountry = document.getElementById('j_id0:myForm:pgBlock:pgBlockSectionAddressInfo:j_id82:actShippingCountry');
var shippingPostalCode = document.getElementById('j_id0:myForm:pgBlock:pgBlockSectionAddressInfo:j_id76:actShippingPostalCode');
var BillingStreet = document.getElementById('j_id0:myForm:pgBlock:pgBlockSectionAddressInfo:j_id55:actBillingStreet');
var BillingCity = document.getElementById('j_id0:myForm:pgBlock:pgBlockSectionAddressInfo:j_id61:actBillingCity');
var BillingState = document.getElementById('j_id0:myForm:pgBlock:pgBlockSectionAddressInfo:j_id67:actBillingState');
var BillingCountry = document.getElementById('j_id0:myForm:pgBlock:pgBlockSectionAddressInfo:j_id79:actBillingCountry');
var BillingPostalCode = document.getElementById('j_id0:myForm:pgBlock:pgBlockSectionAddressInfo:j_id73:actBillingPostalCode');
shippingStreet.value = BillingStreet.value;
shippingCity.value = BillingCity.value;
shippingState.value = BillingState.value;
shippingCountry.value = BillingCountry.value;
shippingPostalCode.value = BillingPostalCode.value;
}
</script>
<apex:sectionHeader title="Account Edit" subtitle="{!Account.Name}" />
<apex:pageBlock id="pgBlock" mode="edit" title="Account Edit">
<apex:pageBlockButtons location="both">
<apex:commandButton value="Save" action="{!Save}"/>
<apex:commandButton value="Cancel" action="{!Cancel}"/>
</apex:pageBlockButtons>
<apex:pageBlockSection id="pgBlockSectionAcctInfo" title="Account Information" collapsible="false" columns="2" >
<apex:pageBlockSectionItem >
<apex:outputLabel >Account Owner</apex:outputLabel>
<apex:outputField id="actOwner" value="{!account.ownerid}" />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Rating</apex:outputLabel>
<apex:inputField id="actRating" value="{!account.rating}" />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Account Name</apex:outputLabel>
<apex:inputField id="actName" value="{!account.name}" required="true" />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Phone</apex:outputLabel>
<apex:inputField id="actPhone" value="{!account.Phone}" />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Parent Account</apex:outputLabel>
<apex:inputField id="actParentAccount" value="{!account.ParentId}" />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Fax</apex:outputLabel>
<apex:inputField id="actFax" value="{!account.Fax}" />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Account Number</apex:outputLabel>
<apex:inputField id="actNumber" value="{!account.Accountnumber}" />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Website</apex:outputLabel>
<apex:inputField id="actWebsite" value="{!account.Website}" />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Account Site</apex:outputLabel>
<apex:inputField id="actSite" value="{!account.Site}" />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Ticker Symbol</apex:outputLabel>
<apex:inputField id="actTicker" value="{!account.TickerSymbol}" />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Type</apex:outputLabel>
<apex:inputField id="actType" value="{!account.Type}" />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Ownership</apex:outputLabel>
<apex:inputField id="actOwnership" value="{!account.Ownership}" />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Industry</apex:outputLabel>
<apex:inputField id="actIndustry" value="{!account.Industry}" />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Employees</apex:outputLabel>
<apex:inputField id="actEmployees" value="{!account.NumberOfEmployees}" />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Annual Revenue</apex:outputLabel>
<apex:inputField id="actAnnualRevenue" value="{!account.AnnualRevenue}" />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >SIC Code</apex:outputLabel>
<apex:inputField id="actSIC" value="{!account.Sic}" />
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
<apex:pageBlockSection id="pgBlockSectionAddressInfo" title="Address Information" collapsible="false" columns="2">
<apex:facet name="header">
<span class="pbSubExtra">
<span class="bodySmall">
<a href="javascript:copyAddress();">Copy Billing Address to Shipping Address</a>
</span>
</span>
<h3>Address Information<span class="titleSeparatingColon">:</span></h3>
</apex:facet>
<apex:pageBlockSectionItem >
<apex:outputLabel >Billing Street</apex:outputLabel>
<apex:inputField id="actBillingStreet" value="{!account.BillingStreet}" />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Shipping Street</apex:outputLabel>
<apex:inputField id="actShippingStreet" value="{!account.ShippingStreet}" />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Billing City</apex:outputLabel>
<apex:inputField id="actBillingCity" value="{!account.BillingCity}" />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Shipping City</apex:outputLabel>
<apex:inputField id="actShippingCity" value="{!account.ShippingCity}" />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Billing State/Province</apex:outputLabel>
<apex:inputField id="actBillingState" value="{!account.BillingState}" />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Shipping State/Province</apex:outputLabel>
<apex:inputField id="actShippingState" value="{!account.ShippingState}" />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Billing Zip/Postal Code</apex:outputLabel>
<apex:inputField id="actBillingPostalCode" value="{!account.BillingPostalCode}" />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Shipping Zip/Postal Code</apex:outputLabel>
<apex:inputField id="actShippingPostalCode" value="{!account.ShippingPostalCode}" />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Billing Country</apex:outputLabel>
<apex:inputField id="actBillingCountry" value="{!account.BillingCountry}" />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Shipping Country</apex:outputLabel>
<apex:inputField id="actShippingCountry" value="{!account.ShippingCountry}" />
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
<apex:pageBlockSection id="pgBlockSectionAdditionalInformation" title="Additional Information" collapsible="false" columns="2">
<!--ANY CUSTOM FIELDS / ADDITIONAL INFORMATION CAN GO HERE-->
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
to know what is J_id0 click below linkhttps://developer.salesforce.com/forums?id=906F0000000950IIAQ
No comments:
Post a Comment