+ Start a Discussion
JDegnerJDegner 

Using actionsupport in component throws URL error

I'm having a problem using actionsupport in my component. I think this should be simple, but for the life of me I can't figure it out!! Any help is greatly appreciated!

 

I have the actionsupport running onchange of a selectList. When I change the selectList, a Salesforce page with this on it comes up:

 

URL No Longer Exists You have attempted to reach a URL that no longer exists on salesforce.com.

 

<apex:component id="LFIUpload" controller="LFIUtilities">
<apex:attribute type="StringCarrier" name="theString" description="The string to update" assignTo="{!stringVal}"/>
<apex:attribute type="IdCarrier" name="theID" description="The string to update" assignTo="{!stringID}"/>
         
<style>
    fileFont {color:#27408B;font-size: 11pt;font-bold;aling:left;}
    messageFont {color:#B40404;font-size: 11pt;font-bold;}
    h1 {color:#27408B;font-size: 18pt;font-bold;}
    searchFont {color:gray;font-size: 12pt;}
</style>

<apex:panelGrid columns="3" id="theGrid" cellpadding="0">
<apex:panelGroup id="theGroup">
    <fileFont><apex:outputLabel value="Document Name"/></fileFont>
    <apex:inputtext id="name" value="{!docName}"/>
</apex:panelGroup>

<apex:panelGroup id="theGroup2">
    <fileFont>
        <apex:outputLabel value="Folder"/>
        <apex:selectList value="{!LFFolder}" size="1" id="selectListServiceType" multiselect="false">
            <apex:selectOptions id="listOptions" value="{!items}"/> 
                    <apex:actionSupport event="onchange" action="{!clearTheMessage}" reRender="messageGroup"/>
        </apex:selectList>
    </fileFont>
</apex:panelGroup>

  <apex:panelGroup id="theGroup3">
    <div style="background-color:#EEEEEE;padding: 5px">
        <fileFont><apex:outputLabel value="Upload or Drag & Drop Document"/></fileFont><br></br>
        <apex:inputFile value="{!docFile}" filename="{!nameFile}"/> 
    </div>
</apex:panelGroup>
</apex:panelGrid>


    <apex:panelGrid columns="2" id="theMessageGrid" cellpadding="0">
        <apex:panelGroup id="theGroup4">
             <apex:commandButton style="fileFont" action="{!callLFI}" value="Save" id="theButton"/>
        </apex:panelGroup>
        <apex:panelGroup id="messageGroup">
                <messageFont>{!theMessage}</messageFont>
        </apex:panelGroup>
    </apex:panelGrid>
</apex:component>

 

 public Void clearTheMessage(){
        theMessage='';
    }

 

Best Answer chosen by Admin (Salesforce Developers) 
JDegnerJDegner

I wanted to post back what my solution was, hopefully it will help someone else.

 

I did a search on the URL error, and found a new setting in Setup-->Security Controls-->Session Settings - Enable clickjack protection for setup pages. Once I unchecked this setting, I was able to see the real error that was occurring:

 

apex:inputFile can not be used in conjunction with an action component, apex:commandButton or apex:commandLink that specifies a rerender or oncomplete attribute

 


Now that I had tha, I was able to find numerous posts on using an actionRegion to work around the problem, which I did....and it worked!!!

 


Here's my resolution:

<apex:component id="LFIUpload" controller="LFIUtilities">
<apex:attribute type="StringCarrier" name="theString" description="The string to update" assignTo="{!stringVal}"/>
<apex:attribute type="IdCarrier" name="theID" description="The string to update" assignTo="{!stringID}"/>

<style>
    fileFont {color:#27408B;font-size: 11pt;font-bold;aling:left;}
    messageFont {color:#B40404;font-size: 11pt;font-bold;}
    h1 {color:#27408B;font-size: 18pt;font-bold;}
    searchFont {color:gray;font-size: 12pt;}
</style>

<apex:panelGrid columns="3" id="theGrid" cellpadding="0">
<apex:panelGroup id="theGroup">
    <fileFont><apex:outputLabel value="Document Name"/></fileFont>
    <apex:inputText id="name" value="{!docName}"/>
</apex:panelGroup>

<apex:panelGroup id="theGroup2">
    <fileFont>
        <apex:outputLabel value="Folder"/>
        <apex:actionRegion >
        <apex:selectList value="{!LFFolder}" size="1" id="selectListServiceType" multiselect="false">
        <apex:actionSupport event="onchange" action="{!clearInfo}" reRender="messagePanel"/>
            <apex:selectOptions id="listOptions" value="{!items}"/> 
        </apex:selectList>
        </apex:actionregion>
    </fileFont>
</apex:panelGroup>

<apex:panelGroup id="theGroup3">
    <fileFont><apex:outputLabel value="Upload or Drag & Drop File"/>
    <apex:inputFile value="{!docFile}" filename="{!nameFile}"/></fileFont>
</apex:panelGroup>
</apex:panelGrid>

<apex:panelGrid columns="1" id="theMessageGrid" cellpadding="0" border="">
<apex:panelGroup id="theGroup4">
     <apex:commandButton style="fileFont" action="{!callLFI}" value="Save" id="theButton"/>
</apex:panelGroup>
</apex:panelGrid>
<apex:outputpanel id="messagePanel">
    <messageFont>{!theMessage}</messageFont>
</apex:outputpanel>
</apex:component>

 

 public PageReference clearInfo(){
        theMessage = '';
        return null;
    }