function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
balakrishna mandula 19balakrishna mandula 19 

command button with inputfile

Hi 
I have a requirement on VF page which is taking fields from fieldsets. this page contains <inputfile> and commandbutton in the form. whenever Save is clicked, then entire page with the attachment will be saved. but whenever validation is occured both custom or standard validation, attachment is getting cleared. 

Attachment should be retained even if page is saving.
 
<apex:pageBlock title="New Change Request" id="pgBlckId">
                                        <apex:pageMessages />
                                        <apex:pageBlockButtons >
                                            <apex:commandButton value="Submit Change Request" action="{!saveChangeRequestOnCreation}" status="actStatusId" reRender="pgscId"/>
                                            <apex:commandButton value="Cancel" action="{!cancelCR}" immediate="true"/>
                                            <apex:outputPanel id="opid">
                                                <apex:actionStatus id="actStatusId" >
                                                    <apex:facet name="start" >
                                                        <img src="/img/loading.gif" />
                                                    </apex:facet>
                                                </apex:actionStatus> 
                                            </apex:outputPanel>
                                        </apex:pageBlockButtons>
                                        <apex:repeat value="{!crFS}" var="fskey">
                                            <apex:pageBlockSection title="{!crFS[fskey].Fieldset_Label_Name__c}" id="pgscId">
                                                <apex:repeat value="{!$ObjectType.BMCServiceDesk__Change_Request__c.FieldSets[crFS[fskey].Fieldset_Api_Name__c]}"  var="f">
                                                    <apex:pageBlockSectionItem >
                                                        <apex:outputLabel value="{!f.label}" rendered="{!IF(f.Label == '<BLANK>', FALSE, TRUE)}"/>
                                                        <apex:inputField value="{!cr[f.fieldPath]}" required="{!OR(f.DBRequired, f.required)}" rendered="{!IF(f.Label == '<BLANK>', FALSE, TRUE)}"/>
                                                    </apex:pageBlockSectionItem>
                                                </apex:repeat>
                                            </apex:pageBlockSection>
                                        </apex:repeat>
                                        Attach File <apex:inputFile value="{!attachment1_blob}" filename="{!attfileName1}" id="test" />
                                    </apex:pageBlock>

please help to resolve this issue
Prem Anandh 1Prem Anandh 1
Are you able to reRender <apex:inputFile>. As per my knowledge it will throw view state issue. 
balakrishna mandula 19balakrishna mandula 19
Hi Prem,

we can't use reRender in command button and inputfile in same form. please suggest how acheiev this functionality. I even used action region.
Prem Anandh 1Prem Anandh 1
You can achive by Iframe but not sure this case it will referesh selected file.