-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
3Questions
-
4Replies
Visualforce page language and locale
I created a public landing page for customers (anonymous access), I would to have the page in english, german, french or italian but maintaining formatting (dates and numbers) of the client/browser. I have set language attribute in apex:page for have fields description in language, I used Date.format() for format dates on outputText but I am non able to format inputField.
For example when page is in english I see always dates formatted on american (MM/DD/YYYY) and not on europen (DD/MM/YYYY).
Someone has advice for me ?
Have a nice day
-
- Mikron Admin
- May 21, 2015
- Like
- 0
- Continue reading or reply
Return URL for a page
Hello,
When I cancel an operation on a Visualforce page, I would like to return to the calling page.
In my case, the Visualforce page is invoked from a custom button placed on an object view.
Is it possible to get an object view URL? I tried, but I could not find a specific merge field to pass the current page URL as a parameter (retURL).
-
- Mikron Admin
- October 02, 2009
- Like
- 0
- Continue reading or reply
Problems with ReRender attribute
Hello.
i am a beginner with VisualForce programming.
I am trying to change some control status (chooseOperation and aquoteNumber) after changing the values of the controlling picklists.
However the ReRender attribute seems never working.
Can someone help me understand what I am doing wrong?
Visualforce code:
<apex:page standardController="Opportunity" extensions="QuoteToolRequestController">
<apex:sectionHeader title="New Quote Request"/>
<apex:form >
<apex:pageBlock mode="edit">
<apex:pageBlockButtons location="bottom">
<apex:commandButton action="{!save}" value="Save"/>
</apex:pageBlockButtons>
<apex:outputText value="{!opportunity.OPPORTUNITYCODE_MK__c}" rendered="false"/>
<apex:pageBlockSection title="Quote Request Information" columns="2">
<apex:outputLabel value="Choose Operation " for="chooseOperation"/>
<apex:selectList id="chooseOperation" value="{!selectedOperation}" size="1">
<apex:selectOptions value="{!operationList}"/>
<apex:actionSupport event="onchange" reRender="quoteNumber,chooseCode" />
</apex:selectList>
<apex:outputLabel value="Choose Code to revision" for="chooseCode"/>
<apex:selectList id="chooseCode" value="{!selectedCode}" size="1" disabled="{!codeSelectionDisabled}">
<apex:selectOptions value="{!codeList}"/>
<apex:actionSupport event="onchange" reRender="quoteNumber" />
</apex:selectList>
<apex:outputLabel value="Quote Number" for="quoteNumber"/>
<apex:outputText id="quoteNumber" value="{!quotationName}" />
</apex:pageBlockSection>
<apex:pageBlockSection title="Quote Information" columns="1">
<apex:pageBlockSectionItem >
<apex:outputLabel value="Assignee" for="assignee"/>
<apex:inputField id="assignee" value="{!quotation.assignee__c}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel value="Due date" for="dueDate"/>
<apex:inputField id="dueDate" value="{!quotation.due_date__c}"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
<apex:pageBlockSection title="Technical Information" columns="1">
<apex:pageBlockSectionItem >
<apex:outputLabel value="Requirements" for="requirements"/>
<apex:inputField id="requirements" value="{!quotation.requirements__c}" required="true"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
<apex:pageMessages showDetail="true"></apex:pageMessages>
</apex:pageBlock>
</apex:form>
</apex:page>
Controller:
public class QuoteToolRequestController {
// FIELDS
private Opportunity parentOpportunity;
private Quotation__c quotation = new Quotation__c();
private List<SelectOption> operationList = new List<SelectOption>();
private List<SelectOption> codeList = new List<SelectOption>();
private Map<Integer,Integer> codeMap = new Map<Integer,Integer>(); // MAPPA DEI CODICI (Key = Quotation__c.code__c, Value = Quotation__c.version__c)
private Integer selectedOperation = 0; // selected Operation type for Quote Revision
private Integer selectedCode = 1; // selected Code for Quote Revision
private Integer maxCode = 0; // highest Code in all existing Quotes
// FIELDS
// PROPERTIES
public void setSelectedOperation(Integer value) {
this.selectedOperation = value;
}
public Integer getSelectedOperation() {
return this.selectedOperation;
}
public void setSelectedCode(Integer value) {
this.selectedCode = value;
}
public Integer getSelectedCode() {
return this.selectedCode;
}
public Quotation__c getQuotation() {
return this.quotation;
}
public List<SelectOption> getOperationList() {
return this.operationList;
}
public List<SelectOption> getCodeList() {
return this.codeList;
}
public boolean getCodeSelectionDisabled() {
return (this.selectedOperation <> 1);
}
public Integer getCode() {
if (this.selectedOperation == 0) {
return this.maxCode+1;
} else {
return this.selectedCode;
}
}
public Integer getVersion() {
if (this.selectedOperation == 0) {
return 1;
} else {
return (this.codeMap.get(selectedCode)+1);
}
}
public String getQuotationName() {
String quotationName = this.parentOpportunity.OPPORTUNITYCODE_MK__c;
Integer code = this.getCode();
Integer version = this.getVersion();
if (code < 10) {
quotationName = quotationName + '.0' + code;
} else {
quotationName = quotationName + '.' + code;
}
if (version < 10) {
quotationName = quotationName + '.0' + version;
} else {
quotationName = quotationName + '.' + version;
}
return quotationName;
}
// PROPERTIES
// CONSTRUCTOR
public QuoteToolRequestController(ApexPages.StandardController myController) {
parentOpportunity=(Opportunity)myController.getrecord();
operationList.add(new SelectOption('0','New Quote Code'));
initialize();
if (!codeList.isEmpty()) {
operationList.add(new SelectOption('1','New Quote Revision'));
//selectedCode = Integer.valueof(codeList.get(0).getValue());
}
}
// CONSTRUCTOR
public void initialize()
{
// VETTORE DELLE QUOTE DELL'OPPORTUNITÀ
List<Quotation__c> quoteVector = new List<Quotation__c>();
quoteVector = [select code__c, version__c
from Quotation__c
where Opportunity__r.ID = :parentOpportunity.ID];
for(Quotation__c quote: quoteVector) {
Integer quoteCode = quote.CODE__C.intValue();
Integer quoteVersion = quote.VERSION__C.intValue();
if (quoteCode > maxCode) {
maxCode = quoteCode;
}
if (codeMap.containsKey(quoteCode)) {
if (quoteVersion > codeMap.get(quoteCode))
codeMap.put(quoteCode,quoteVersion);
} else {
codeMap.put(quoteCode,quoteVersion);
codeList.add(new SelectOption(quoteCode.format(),quoteCode.format()));
}
}
// A QUESTO PUNTO SONO VALORIZZATE LE SEGUENTI VARIABILI:
// maxCode = MAX(code)
// codeMap = MAP(Code,MAX(version))
}
public PageReference save() {
quotation.name = getQuotationName();
quotation.opportunity__c = parentOpportunity.ID;
quotation.recordTypeID = '012200000000yEaAAI'; // Tool
quotation.status__c = 'Requested';
quotation.code__c = getCode();
quotation.version__c = getVersion();
insert(quotation);
// Redirect to Opportunity Page
PageReference opportunityPage = new PageReference('/'+parentOpportunity.ID);
opportunityPage.setRedirect(true);
return opportunityPage;
}
}
-
- Mikron Admin
- February 23, 2009
- Like
- 0
- Continue reading or reply
Visualforce page language and locale
I created a public landing page for customers (anonymous access), I would to have the page in english, german, french or italian but maintaining formatting (dates and numbers) of the client/browser. I have set language attribute in apex:page for have fields description in language, I used Date.format() for format dates on outputText but I am non able to format inputField.
For example when page is in english I see always dates formatted on american (MM/DD/YYYY) and not on europen (DD/MM/YYYY).
Someone has advice for me ?
Have a nice day
- Mikron Admin
- May 21, 2015
- Like
- 0
- Continue reading or reply
Windows style error messages..... unknown error in unknown
Hey Guys,
This one has just popped up on a clients org when running test classes, im frantically searching through the config to make sure no one has change something to unique but i havent found anything yet, any ideas?
System.DmlException: Insert failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: <unknown> duplicates value on record with id: <unknown>
- Autobat
- February 26, 2009
- Like
- 0
- Continue reading or reply
Problems with ReRender attribute
Hello.
i am a beginner with VisualForce programming.
I am trying to change some control status (chooseOperation and aquoteNumber) after changing the values of the controlling picklists.
However the ReRender attribute seems never working.
Can someone help me understand what I am doing wrong?
Visualforce code:
<apex:page standardController="Opportunity" extensions="QuoteToolRequestController">
<apex:sectionHeader title="New Quote Request"/>
<apex:form >
<apex:pageBlock mode="edit">
<apex:pageBlockButtons location="bottom">
<apex:commandButton action="{!save}" value="Save"/>
</apex:pageBlockButtons>
<apex:outputText value="{!opportunity.OPPORTUNITYCODE_MK__c}" rendered="false"/>
<apex:pageBlockSection title="Quote Request Information" columns="2">
<apex:outputLabel value="Choose Operation " for="chooseOperation"/>
<apex:selectList id="chooseOperation" value="{!selectedOperation}" size="1">
<apex:selectOptions value="{!operationList}"/>
<apex:actionSupport event="onchange" reRender="quoteNumber,chooseCode" />
</apex:selectList>
<apex:outputLabel value="Choose Code to revision" for="chooseCode"/>
<apex:selectList id="chooseCode" value="{!selectedCode}" size="1" disabled="{!codeSelectionDisabled}">
<apex:selectOptions value="{!codeList}"/>
<apex:actionSupport event="onchange" reRender="quoteNumber" />
</apex:selectList>
<apex:outputLabel value="Quote Number" for="quoteNumber"/>
<apex:outputText id="quoteNumber" value="{!quotationName}" />
</apex:pageBlockSection>
<apex:pageBlockSection title="Quote Information" columns="1">
<apex:pageBlockSectionItem >
<apex:outputLabel value="Assignee" for="assignee"/>
<apex:inputField id="assignee" value="{!quotation.assignee__c}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel value="Due date" for="dueDate"/>
<apex:inputField id="dueDate" value="{!quotation.due_date__c}"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
<apex:pageBlockSection title="Technical Information" columns="1">
<apex:pageBlockSectionItem >
<apex:outputLabel value="Requirements" for="requirements"/>
<apex:inputField id="requirements" value="{!quotation.requirements__c}" required="true"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
<apex:pageMessages showDetail="true"></apex:pageMessages>
</apex:pageBlock>
</apex:form>
</apex:page>
Controller:
public class QuoteToolRequestController {
// FIELDS
private Opportunity parentOpportunity;
private Quotation__c quotation = new Quotation__c();
private List<SelectOption> operationList = new List<SelectOption>();
private List<SelectOption> codeList = new List<SelectOption>();
private Map<Integer,Integer> codeMap = new Map<Integer,Integer>(); // MAPPA DEI CODICI (Key = Quotation__c.code__c, Value = Quotation__c.version__c)
private Integer selectedOperation = 0; // selected Operation type for Quote Revision
private Integer selectedCode = 1; // selected Code for Quote Revision
private Integer maxCode = 0; // highest Code in all existing Quotes
// FIELDS
// PROPERTIES
public void setSelectedOperation(Integer value) {
this.selectedOperation = value;
}
public Integer getSelectedOperation() {
return this.selectedOperation;
}
public void setSelectedCode(Integer value) {
this.selectedCode = value;
}
public Integer getSelectedCode() {
return this.selectedCode;
}
public Quotation__c getQuotation() {
return this.quotation;
}
public List<SelectOption> getOperationList() {
return this.operationList;
}
public List<SelectOption> getCodeList() {
return this.codeList;
}
public boolean getCodeSelectionDisabled() {
return (this.selectedOperation <> 1);
}
public Integer getCode() {
if (this.selectedOperation == 0) {
return this.maxCode+1;
} else {
return this.selectedCode;
}
}
public Integer getVersion() {
if (this.selectedOperation == 0) {
return 1;
} else {
return (this.codeMap.get(selectedCode)+1);
}
}
public String getQuotationName() {
String quotationName = this.parentOpportunity.OPPORTUNITYCODE_MK__c;
Integer code = this.getCode();
Integer version = this.getVersion();
if (code < 10) {
quotationName = quotationName + '.0' + code;
} else {
quotationName = quotationName + '.' + code;
}
if (version < 10) {
quotationName = quotationName + '.0' + version;
} else {
quotationName = quotationName + '.' + version;
}
return quotationName;
}
// PROPERTIES
// CONSTRUCTOR
public QuoteToolRequestController(ApexPages.StandardController myController) {
parentOpportunity=(Opportunity)myController.getrecord();
operationList.add(new SelectOption('0','New Quote Code'));
initialize();
if (!codeList.isEmpty()) {
operationList.add(new SelectOption('1','New Quote Revision'));
//selectedCode = Integer.valueof(codeList.get(0).getValue());
}
}
// CONSTRUCTOR
public void initialize()
{
// VETTORE DELLE QUOTE DELL'OPPORTUNITÀ
List<Quotation__c> quoteVector = new List<Quotation__c>();
quoteVector = [select code__c, version__c
from Quotation__c
where Opportunity__r.ID = :parentOpportunity.ID];
for(Quotation__c quote: quoteVector) {
Integer quoteCode = quote.CODE__C.intValue();
Integer quoteVersion = quote.VERSION__C.intValue();
if (quoteCode > maxCode) {
maxCode = quoteCode;
}
if (codeMap.containsKey(quoteCode)) {
if (quoteVersion > codeMap.get(quoteCode))
codeMap.put(quoteCode,quoteVersion);
} else {
codeMap.put(quoteCode,quoteVersion);
codeList.add(new SelectOption(quoteCode.format(),quoteCode.format()));
}
}
// A QUESTO PUNTO SONO VALORIZZATE LE SEGUENTI VARIABILI:
// maxCode = MAX(code)
// codeMap = MAP(Code,MAX(version))
}
public PageReference save() {
quotation.name = getQuotationName();
quotation.opportunity__c = parentOpportunity.ID;
quotation.recordTypeID = '012200000000yEaAAI'; // Tool
quotation.status__c = 'Requested';
quotation.code__c = getCode();
quotation.version__c = getVersion();
insert(quotation);
// Redirect to Opportunity Page
PageReference opportunityPage = new PageReference('/'+parentOpportunity.ID);
opportunityPage.setRedirect(true);
return opportunityPage;
}
}
- Mikron Admin
- February 23, 2009
- Like
- 0
- Continue reading or reply