0

Controller:

public class updateOpp{

    public String Name {get;set;}
    public Boolean selectRecordDel {get;set;}


    public PageReference submit() {
        system.debug(Name);
        system.debug(selectRecordDel);
        return null;
    }          
}

Page

  <apex:page sidebar="true" controller="UpdateOpp" lightningStylesheets="true"  docType="html-5.0" standardStylesheets="false" cache="false">
 <apex:slds />
   <body class="slds-scope">
    <apex:outputPanel id="myRerender">
    <apex:form >
     <apex:pagemessages />
     <apex:pageBlock >
      <div class="slds-form slds-form_horizontal">
        <center>
             <div class="slds-text-title" style="padding: 0.5rem; background: rgb(0, 92, 153);">
             <div class="slds-text-color_inverse">Update</div>
             </div>
          </center><br/>

          <div class="slds-form">      
          <div class="slds-form-element slds-form-element_horizontal">
          <label class="slds-form-element__label" for="text-input-02">Name</label>
          <div class="slds-form-element__control">
          <input id="text-input-02" class="slds-input" type="text" placeholder="Placeholder Text" value="{!name}"/>
          </div>
          </div>
          </div>
          <fieldset class="slds-form-element slds-form-element_horizontal">
            <div class="slds-form-element__control">
            <div class="slds-checkbox">
            <input type="checkbox" name="default" id="checkbox-25" value="{!selectDel}" />
            <label class="slds-checkbox__label" for="checkbox-25">
            <span class="slds-checkbox_faux"></span>
            <span class="slds-form-element__label">Delete records</span>
            </label>
            </div>
            </div>
            </fieldset>
            <br/>
            <div class="slds-align_absolute-center" >
             <apex:commandButton styleClass="slds-button slds-button--brand slds-button--neutral slds-not-selected" action="{!Submit}" value="Submit" id="theButton2" style="width:160px;"/>   
              </div>
            <br/><br/>
            </div>
             </apex:pageBlock>
   </apex:form>   
</apex:outputPanel>
</body>
</apex:page>
  • What exactly is your issue – Reshma Jan 9 at 11:26
  • Both the form imputs are always null. – shukla yogesh Jan 9 at 11:37
0

Use <apex:input> element instead of <input>.

  • I can't use slds with that, class properties are unsupported. – shukla yogesh Jan 9 at 11:43
  • you can use 'styleClass' with apex:input – McH2000 Jan 9 at 11:44
  • I see lot of issues in using apex:input. Are the SLDS components not supported? I believe the main intention was to use them in visualforce pages. This is always readonly.. <apex:inputCheckbox value="{!selectOrderDel}" disabled="false"/> – shukla yogesh Jan 9 at 12:06
  • That's true - the apex:inputCheckbox id gets set to something a bit strange so it doesn't work. – McH2000 Jan 9 at 13:19
  • As a quick hack you can check to see what the id of the input element generated with the apex:inputcheckbox is and then use that id in the for property of the label. Otherwise I guess use some javascript to set the value in the controller? – McH2000 Jan 9 at 13:38
0

You need do replace:

<input type="text"> by apex:inputText or apex:inputField

<input type="checkbox"> by apex:inputCheckbox

You can use style or styleClass property for these tags. If you want lightning experience style use <apex:slds/>

Also please update your checkbox value as {!selectRecordDel}.

  • Problem is checkbox becomes readonly. <apex:inputcheckbox value="{!selectOrderDel}" /> If I use this value is not passed: <input type="checkbox" name="default" id="checkbox-25" value="{!selectOrderDel}" /> – shukla yogesh Jan 9 at 12:17
  • Is checkbox readonly while using apex:inputCheckbox – Reshma Jan 9 at 12:23
  • Yes. Its readonly – shukla yogesh Jan 9 at 13:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.