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
TheLearnerTheLearner 

Displaying error button on page

Hi,

Experts, i added button called 'Permit to dig'(i assigned a visualforce page to this button) to a object TWM_Tasks__c so this button  need to allow only with record type Intall and when the Type of install(Type_of_Install__c)='External' if its 'Internal or Screw in' it should not now allow it.could anyone help me please
surasura
Use rendered attribute of command button and make it display only when record type of install  is  External

eg:
 
<apex:commandbutton value="permit to dig" rendered="{! record.Type_Of_Install__c='External'}" />
TheLearnerTheLearner
Hi,

i created button for the custom object, i havent used commandbutton , i created the button for that custom object and assiged this page to that button.. im giving sample not entire page.

<apex:page standardcontroller="TWM_Tasks__c"  extensions="TWM_Permit_PermittoDig_controller" showHeader="false" sidebar="false" renderAs="pdf" >
<head>
            <style>
            @page {
                
                    //orientation: landscape;  /* Landscape orientation */
                    //size: 3.55in 2.21in;     /* 3.41in 2.13in width height Landscape orientation*/
                    //margin:0%;
                    margin-top: 0%;
                    margin-bottom: 0%;       

                }
                table.mystyle
                {
                    border-width: 1px 1px 1px 1px;
                    border-spacing: 0;
                    border-collapse: collapse;
                    border-style: solid;
                    font-family: Arial Unicode MS;
                }
                .mystyle td, .mystyle th
                {
                    margin: 0;
                    padding: 4px;
                    border-width: 1px 1px 1px 1px;
                    border-style: solid;
                }

                .HeaderRow
                {
                    font-family: Arial Unicode MS;
                    font-size: 8px;
                    font-weight: bold;
                }
                .TableRow
                {
                    font-family: Arial Unicode MS;
                    font-size: 8px;
                }
                 .Instruct
                {
                    font-family: Arial Unicode MS;
                    font-size: 8px;
                    color:#FF0000;
                }
                pbr { page-break-after: always; }
        </style>
    </head>
   
 <table columns="3" border="0" cellpadding="0" cellspacing="0" width="100%" align="center">
        
        <tr>
        <td align="center" colspan="3"></td>
        </tr>
 </table>
       <table class="mystyle" columns="4" border="1" cellpadding="0" cellspacing="0" width="100%" align="center">
        <tr align="center">
           
        </tr>
          <tr align="center">
          <tr align="center">
           
            <td class="HeaderRow"  width="60%" colspan="4">Job Details </td>
        </tr>
                    <tr align="left">
                        <td width="70%" class="TableRow" bgcolor="d3d3d3">Customer</td>
                          <td  width="40%">{!TWM_Tasks__c.Customer__c}</td>     
                    </tr>
                   
                    <tr align="left">
                        <td  width="40%" class="TableRow" bgcolor="d3d3d3">Address</td>
                         <td  width="20%">{!TWM_Tasks__c.Address__c}</td>
                        
                        </tr>
                        <tr align="left">
                        <td  width="40%" class="TableRow" bgcolor="d3d3d3">Task</td>
                         <td  width="10%">{!TWM_Tasks__c.Task__c}</td>
                        
                        </tr>
                        <tr align="left">
                        <td  width="40%" class="TableRow" bgcolor="d3d3d3">Job NO.</td>
                         <td  width="10%">{!TWM_Tasks__c.Job_No__c}</td>
                        
                        </tr>
                        <tr align="left">
                        <td  width="40%" class="TableRow" bgcolor="d3d3d3">Attended</td>
                         <td  width="10%">
                           <apex:outputText value="{0,date,dd'/'MM'/'yyyy}">
                            <apex:param value="{!TWM_Tasks__c.Attended__c}" />
                            </apex:outputText>
                           </td>
                       
                        </tr>
                        <tr align="left">
                        <td  width="40%" class="TableRow" bgcolor="d3d3d3">Completed</td>
                         <td  width="10%">
                           <apex:outputText value="{0,date,dd'/'MM'/'yyyy}">
                           <apex:param value="{!TWM_Tasks__c.Completed__c}" />
                           </apex:outputText>
                           </td>
                          
                        </tr>
                        <tr align="left">
                        <td  width="40%" class="TableRow" bgcolor="d3d3d3" height="30">On-Site Personnel</td>
                         <td  width="10%">{!TWM_Tasks__c.On_Site_Personnel__c}</td>
                        
                        </tr>
                        <tr align="left">
                        <td  width="40%" class="TableRow" bgcolor="d3d3d3" height="25">On-Site Visitors</td>
                         <td  width="10%">{!TWM_Tasks__c.On_Site_Visitors__c}</td>
                        
                        </tr>
                      </tr>
                      
                    </table>
                     <br></br>
              
                       
                      </table>
                     
           </apex:page>
          
surasura
you can 't use input componets and form elements in pages rendered as PDF 

PDF.Rendering a Visualforce page as a PDF is intended for pages that are designed and optimized for print. Standard components that aren't easily formatted for print or contain form elements like inputs, buttons, any component that requires JavaScript to be formatted, shouldn't be used. This includes but is not limited to, any component that requires a form element. Verify the format of your rendered page before deploying it.