• Justin Denning
  • NEWBIE
  • 20 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 1
    Replies
I'm wold like a checkbox-group to span multiple columns rather than a single column vertically.  

The following worked adding the style manually in Chrome, but not when added to the LWC .css file. What should my .css file be to make this work?
.slds-form-element__control {
    display: inline-grid ;
    grid-template-columns: 1fr 1fr 1fr ;
}

 

When a user clicks a link, jQuery updates the <apex:SelectList>.  It update the selectList value, but it does not fire the onchange event.  How do I get the actionSupport event to fire after the link is clicked?

Thanks in advance.

<script>
       $('#HyperlinkContainer').on("click","a", function (e) {

       var option = $(this).attr("data-option");
      $("select[id$='BudgetSelect']").val(option); 

</script>



<div id="HyperlinkContainer">
      <apex:repeat value="{!Budgets}" var="budgetId">
               <a  data-option="{!budgetId}"></a>
       </apex:repeat>
</div


 <apex:selectList size="1" id="BudgetSelect" value="{!Budget.Id}">               < apex:actionSupport event="onchange" action="{!DoNothing}"  rerender="BudgetPanel"    />
              <apex:selectOptions value="{!budgetOptions}"/>
                  
                    
              </apex:selectList>
          <apex:outputPanel id="BudgetPanel" > {!selectedBudget} 

                                         </apex:outputPanel>

 
I have a dropdown list of regions that seems to be clearing all values in my controller, and I don't know what I'm doing wrong.  Below is the controller and VF page along with 2 pictures- one showing values loading on the initial page load, and showing no values when the Region dropdown is changed.  

Any help is greatly appreciated.

Page at Load
Page after changing the dropdown- RegionId and SelectOptions are cleared
After changing dropdown.
public with sharing class RegionController {

   public  static Id RegionId {get;set;}
   public  static Map<Id, Region__c> Regions {get;set;}
   public  static List<SelectOption> regionOptions {get;set;}


public RegionController
{
     //Default Id for testing
     RegionId = 'a0KA0000001IUO0MAO';

     //Get Map of regions
     Regions =  new Map<Id, Region__c>([SELECT ID, Name FROM Region__c]);

     //Set Region Options
     SelectOption sO;
     regionOptions = new List<SelectOption>();
     for (Id i : Regions.keySet())
     {
         sO = new SelectOption(i, Regions.get(i).Name);
         regionOptions.add(sO);
     } 


}

public PageReference DoNothing() 
    {
        return null;
    }

}
 
<apex:page showHeader="true" controller="RegionController" sidebar="true">

<apex:form>
  <apex:selectList size="1"  value="{!RegionId}" >
              <apex:actionSupport event="onchange" action="{!DoNothing}"  rerender="RegionPanel"    />
              <apex:selectOptions value="{!regionOptions}"/>
  </apex:selectList>
</apex:form>
        
  <apex:outputPanel id="RegionPanel" >
        Region {!RegionId}<br/>
        Options <br/>
         <apex:repeat value="{!RegionOptions}" var="regions">
              {!regions}<br/>
         </apex:repeat>
  </apex:outputPanel>
</apex:page>

 
I'm trying to create a data entry screen where users input costs in a foreign currency by region and month, and display the USD value as a tooltip when the user hovers over the field.  The code below works when the page loads, but it does not update the tooltip value when the user changes the input value.  How would I get it to update the tooltip when the input value is changed?
 
$(function createToolTips() {
        $( ".tool-tip" ).tooltip({  
            content:function(callback) {
            var usdValue = $(this).attr("tiptext"); 
            callback(usdValue);
        },
  })});

<apex:repeat value="{!RegionMap}" var="Region">
<apex:repeat value="{!CostsMap[Region]}" var="Month">
....
<td>         
   <div id="directTooltip"  class="tool-tip" tiptext="{!CostsMap[Region][Month].Costs__c*ExchangeRateMap[Region][Month].toUSD__c}">   
 <apex:inputText   style="width:125px;"   value="{!CostsMap[Region][Month].Costs__c}"                             
 
<apex:actionSupport event="onchange" action="{!updateValue}" reRender="directTooltip"  oncomplete="createToolTips();"  >
                  </apex:inputText> 
             </div>  
         </td>
   </apex:repeat>
</apex:repeat>

User-added image



 
I have a VF page that displays a Content cannot be displayed: Map key not found in map error.  There isn't anything in the debug log or console pertaining to this error.  The page references several maps and I don't know which one the error is referring to.  Is there a debug log setting or another tool that would allow me to track down the issue?
I have a VF page that retrieves a list of records and users can enter an amount and select an exchange rate via a lookup field.  The convertedUSD output field displays the amount based on the selected exchange rate.  The rerender works fine if the user changes the Amount field, but doesn't work when a different Exchange Rate is chosen.  What can be done to make it so that changing the exchange rate lookup will rerender the output field?
 
<tr>
      <td>
			<apex:inputField value="{!List.Forex_Amount__c}">
					<apex:actionSupport event="onchange" action="{!doNothing}" reRender="convertedUSD" />
			</apex:inputField>
      </td>
      <td> 
			<apex:outputText id="convertedUSD" value="{!List.Forex_Amount__c*List.Exchange_Rate__r.Rate__c}" />
     </td>
     <td>
			<apex:inputField   value="{!List.Exchange_Rate__c}" >
				<apex:actionSupport event="onchange" action="{!doNothing}"  reRender="convertedUSD" />
			</apex:inputField> 
    </td>
</tr>

 
I have a form with an inputText field and a commandButton that updates the record, and it updates the field(s) correctly as long as the field doesn't have focus.  However, if the cursor is in the field and the user clicks the update button, the record does not update.  Is there a way to get it to update if the user leaves the cursor in the field?

User-added image

I have a VF page that serves as a data entry screen for regional budgets.  All regions are displayed on the screen, and when a user fills in any of the budget input fields, the record is saved.  The issue is if the user tabs through the data entry fields fast enough, multiple records for the same region are created.  I do not want to make the user wait until the record is created to continue their data entry or use a submit button.  How can I stop multiple records from being created?

 
VF except......
 <apex:column width="80px" headerValue="Estimated Budget"> <apex:inputText size="10" value="{!budgetMap[budget].Estimated_Budget__c}">
    
            <apex:actionSupport event="onchange" action="{!processBudget}" status="topstatus"  rerender="contentLoading"   > 
            <apex:param name="RegionName" value="{!budget}"/>
            
            </apex:actionSupport>
            </apex:inputText>


<apex:column width="80px" headerValue="Discounts"> <apex:inputText size="10" value="{!budgetMap[budget].Discounts__c}"> <apex:actionSupport event="onchange" action="{!processBudget}" status="topstatus" rerender="contentLoading" > <apex:param name="RegionName" value="{!budget}"/> </apex:actionSupport> </apex:inputText> </apex:column>


public void processBudget()
    {//Get Region to be processed
     if(ApexPages.currentPage().getParameters().get('RegionName') != null && ApexPages.currentPage().getParameters().get('RegionName') != '' && ApexPages.currentPage().getParameters().get('RegionName') != 'null')
    {
    //Get budget record from Map- may be an existing record or one not yet inserted
    budget__c budget = budgetMap.get(ApexPages.currentPage().getParameters().get('RegionName'));
    
     Try
        {
          //If record has already been inserted, update it. 
          if(budget.Id <> NULL ) update budget;
           
          //If not yet inserted, insert it.
           else if (budget.Id == NULL) 
           {
           budget = budgetMap.get(ApexPages.currentPage().getParameters().get('RegionName'));
            insert budget;
            //Put the budget back into the Map now that it has an Id
            budgetMap.put(ApexPages.currentPage().getParameters().get('RegionName'), budget);
           }
            
           // ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.CONFIRM, budget.Region__r.Name + ' Updated Successfully.'));
        }
        Catch(Exception e)
        {
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Error, e.getMessage()));
            System.debug('ERROR ' + e.getMessage());
            
        }

 
I have a dropdown list of regions that seems to be clearing all values in my controller, and I don't know what I'm doing wrong.  Below is the controller and VF page along with 2 pictures- one showing values loading on the initial page load, and showing no values when the Region dropdown is changed.  

Any help is greatly appreciated.

Page at Load
Page after changing the dropdown- RegionId and SelectOptions are cleared
After changing dropdown.
public with sharing class RegionController {

   public  static Id RegionId {get;set;}
   public  static Map<Id, Region__c> Regions {get;set;}
   public  static List<SelectOption> regionOptions {get;set;}


public RegionController
{
     //Default Id for testing
     RegionId = 'a0KA0000001IUO0MAO';

     //Get Map of regions
     Regions =  new Map<Id, Region__c>([SELECT ID, Name FROM Region__c]);

     //Set Region Options
     SelectOption sO;
     regionOptions = new List<SelectOption>();
     for (Id i : Regions.keySet())
     {
         sO = new SelectOption(i, Regions.get(i).Name);
         regionOptions.add(sO);
     } 


}

public PageReference DoNothing() 
    {
        return null;
    }

}
 
<apex:page showHeader="true" controller="RegionController" sidebar="true">

<apex:form>
  <apex:selectList size="1"  value="{!RegionId}" >
              <apex:actionSupport event="onchange" action="{!DoNothing}"  rerender="RegionPanel"    />
              <apex:selectOptions value="{!regionOptions}"/>
  </apex:selectList>
</apex:form>
        
  <apex:outputPanel id="RegionPanel" >
        Region {!RegionId}<br/>
        Options <br/>
         <apex:repeat value="{!RegionOptions}" var="regions">
              {!regions}<br/>
         </apex:repeat>
  </apex:outputPanel>
</apex:page>