• jasonwanBella
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 3
    Replies
I am trying to simply call on a javascript to edit the display for a set within a dataTable.

Code:
<script>
function Currency(Double field){
return "hello";
var CurrencyLook = "";
var tempField=field;
if(field<0){tempfield = -field; CurrencyLook += "("; }
if(tempfield>=0){
CurrencyLook += "$"+tempfield;
var CurrencyIndex = CurrencyLook.indexOf(".");
if(CurrencyIndex!=-1 && CurrencyIndex!=null){
if(CurrencyIndex + 3 != CurrencyLook.length() ) CurrencyLook += CurrencyLook+"0";
}
}
if(field<0){CurrencyLook += ")";}
return CurrencyLook;
}
</script>

<apex:outputText rendered="{!ProductGSize>0}">
<apex:repeat value="{!productG}" var="prodG">
<tr><td class="regText" width="">{!prodG.PricebookEntry.Product2.Name}</td>
<td class="regText" width="">{!prodG.Quantity}</td>
<td class="regText" width="">({!prodG.UnitPrice})</td>
<td class="regText" width="">Currency({!prodG.TotalPrice})</td>
</apex:repeat>
</apex:outputText>

 Obviously it doesnt invoke the javascript that I have written. Instead it displays the text as is... 

Any ideas how to get it to run the script and return the modified string value??   Hopefully simple answer. Couldnt get it to work in the controller either cause I have to use <apex:repeat>

Thanks!!!

Code:
<style type="text/css">
@page {  margin-top: 0%;}
table{ font-family: "TTE19DCA30t00"; font-size:7pt; }
.regText { font-size:7pt;}
.boldText { font-size:7pt; font-weight:bold; }
.titleText { font-size:12pt; font-weight:bold;}
body { font-family: "TTE19DCA30t00"; font-size:7pt; }
.space{ font-size:2pt; }
</style>

<table>
<tr>
<td class="regText" width="15%">{!productA.Quantity}</td>
<td class="regText"><apex:outputField value="{!productA.UnitPrice}" /></td>
</tr> 
</table>

 the <apex:outputField > NOT ONLY doesnt take the regText style but it even changes the entire page to Arial font-size:9 for some reason.   Ex: The productA.Quantity turns loses its custom style as well.  

Once I take out outputField, every text on the form goes back to the custom way that I would want.

I was hoping to leverage the currency style form included in outputField to get the right formatting for Product Unit Price.
If there is another way to get the formatting for a currency field such as Unit Price, please let me know then I can avoid this outputField bug.

Thanks.


Is it possible to display custom error message from APEX without Visualforce?
 
Not sure if there is a simple method I might have overlooked. Trying to setup something similar to a validation rule where if a specific field has a value, I want to notify the user that something is wrong in my own custom wording.  Wondering if this works for APEX coding (say, on the top of the page).
I am trying to simply call on a javascript to edit the display for a set within a dataTable.

Code:
<script>
function Currency(Double field){
return "hello";
var CurrencyLook = "";
var tempField=field;
if(field<0){tempfield = -field; CurrencyLook += "("; }
if(tempfield>=0){
CurrencyLook += "$"+tempfield;
var CurrencyIndex = CurrencyLook.indexOf(".");
if(CurrencyIndex!=-1 && CurrencyIndex!=null){
if(CurrencyIndex + 3 != CurrencyLook.length() ) CurrencyLook += CurrencyLook+"0";
}
}
if(field<0){CurrencyLook += ")";}
return CurrencyLook;
}
</script>

<apex:outputText rendered="{!ProductGSize>0}">
<apex:repeat value="{!productG}" var="prodG">
<tr><td class="regText" width="">{!prodG.PricebookEntry.Product2.Name}</td>
<td class="regText" width="">{!prodG.Quantity}</td>
<td class="regText" width="">({!prodG.UnitPrice})</td>
<td class="regText" width="">Currency({!prodG.TotalPrice})</td>
</apex:repeat>
</apex:outputText>

 Obviously it doesnt invoke the javascript that I have written. Instead it displays the text as is... 

Any ideas how to get it to run the script and return the modified string value??   Hopefully simple answer. Couldnt get it to work in the controller either cause I have to use <apex:repeat>

Thanks!!!

Code:
<style type="text/css">
@page {  margin-top: 0%;}
table{ font-family: "TTE19DCA30t00"; font-size:7pt; }
.regText { font-size:7pt;}
.boldText { font-size:7pt; font-weight:bold; }
.titleText { font-size:12pt; font-weight:bold;}
body { font-family: "TTE19DCA30t00"; font-size:7pt; }
.space{ font-size:2pt; }
</style>

<table>
<tr>
<td class="regText" width="15%">{!productA.Quantity}</td>
<td class="regText"><apex:outputField value="{!productA.UnitPrice}" /></td>
</tr> 
</table>

 the <apex:outputField > NOT ONLY doesnt take the regText style but it even changes the entire page to Arial font-size:9 for some reason.   Ex: The productA.Quantity turns loses its custom style as well.  

Once I take out outputField, every text on the form goes back to the custom way that I would want.

I was hoping to leverage the currency style form included in outputField to get the right formatting for Product Unit Price.
If there is another way to get the formatting for a currency field such as Unit Price, please let me know then I can avoid this outputField bug.

Thanks.


Is it possible to display custom error message from APEX without Visualforce?
 
Not sure if there is a simple method I might have overlooked. Trying to setup something similar to a validation rule where if a specific field has a value, I want to notify the user that something is wrong in my own custom wording.  Wondering if this works for APEX coding (say, on the top of the page).