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
Akshay Alandkar 8Akshay Alandkar 8 

Create new Vf page

Hi all , want to create vf page like below 
User-added image

 

 

For this i have written vf page code as
<apex:page id="FeedbackPage" controller="FeedbackClass"   standardStylesheets="false"  showHeader="false" sidebar="false">
    
    <c:ExternalLibrary />
    
    <apex:composition template="GNT__ModalTemplate">
        <apex:define name="ModalContent">
    
    
     <apex:form >
        <apex:pageBlock title="New feedback">
           
            <apex:pageBlockSection >
              
              
        &nbsp;&nbsp;&nbsp;     Type<apex:inputText value="{!Type}"/>   
        &nbsp;&nbsp;&nbsp;     Subject<apex:inputText value="{!Subject}"/>
        &nbsp;&nbsp;&nbsp;     Description<apex:inputTextArea richText="true" value="{!Description}"/>
        &nbsp;&nbsp;&nbsp;     URL<apex:inputText value="{!URL}"/>
              
              
               
            
                 
                <apex:commandButton value="Submit" onclick="alrt()" action="{!save}"/>
            </apex:pageBlockSection>
            
           
        
        
        </apex:pageBlock>
    </apex:form>
    
        </apex:define>
    </apex:composition> 
</apex:page>

 

and Controller is 

public without sharing class FeedbackClass{


public String Description{get;set;}
public String Subject{get;set;}
public String Type{get;set;}
public String URL{get;set;}
public PageReference save() {
Feedback__c ac = new Feedback__c();
ac.Description__c= Description;
ac.Subject__c= Subject;
ac.Type__c= Type;
ac.URL__c= URL;
insert ac;
this.Description = null;
this.Subject= null;
this.Type = null;
return null;
}

}

 

and got result 

User-added image so how to add Picklist field and attachment tab to this vf page please help 

Best Answer chosen by Akshay Alandkar 8
Sai PraveenSai Praveen (Salesforce Developers) 
HI,

Can you try the below code .

Vf page:
 
<apex:page  standardController="Feedback__c" extensions="Redirect_Main"  standardStylesheets="false"  showHeader="false" sidebar="false">
    

    
       
    
     <apex:form >
        <apex:pageBlock title="New feedback">
           
            <apex:pageBlockSection >
              
                 <apex:inputField value="{!accnt.Name}"/> <br/> 
                <apex:inputField value="{!accnt.Type__c}"/> <br/>  
         <apex:inputField value="{!accnt.Subject__c}"/> <br/> 
         <apex:inputField value="{!accnt.Description__c}"/> <br/>
                    <apex:inputFile value="{!file}" filename="{!fileName}"/>


               

            

               
            
                 
                <apex:commandButton value="Submit"  action="{!save}"/>
            </apex:pageBlockSection>
            
           
        
        
        </apex:pageBlock>
    </apex:form>
    

</apex:page>

Apx:
 
public class Redirect_Main {
  public Feedback__c accnt{get;set;}  
public Redirect_Main(ApexPages.StandardController sc) {
        this.accnt = (Feedback__c )sc.getRecord();
    }
  
 public String title{ get;set; }
    public ContentVersion cv { get; set; }
        public String fileName { get; set; }
    public transient  blob file { get; set; }

public PageReference save() {

insert accnt;
    ContentVersion cv = new ContentVersion();
            cv.versionData = file;
            cv.title = 'sample file';
            cv.pathOnClient = fileName;
            cv.FirstPublishLocationId = accnt.id; 
            try
            {
                Insert cv;
            }
            catch (DMLException e)
            {
                ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Error uploading Document in Library'));
                return null;
            }
            finally
            {
                cv = new ContentVersion();
            }
return null;
}
   
}

Let me know if you face any issues.

If this solution helps, Please mark it as best answer.

Thanks,