How can I store date from HTML input tag to salesforce ???? Please help me I am struggling form 3 days...

this is Html input field:

<tr class="date-picker--wrapper">
                    <td style="text-align: right">Leave From  </td>
                    <td><input value="{!myLeave}" type="date" min="Test" id="Test" onchange="selectLeaveStartDate(this.value)" /></td>

 <tr class="date-picker--wrapper">
                    <td style="text-align: right">Leave To  </td>
                    <td><input value="toLeave" type="date" min="Test2" id="Test2"  onchange="selectLeaveEndDate(this.value)"/></td>
function selectLeaveStartDate(e) {
        //console.log('e: '+e);
        document.querySelector("#Test2").setAttribute('min', e);
        var input = document.getElementById("Test").value;

I tried to do with inputHidden but not getting output.

I want to store this selected date from the VF page to leave_Application__c object's field Leave_From__c and leave_to__c.

I am using is Html tag and I am using it in my VF page to select a date. but the problem is when I click save button after inserting all field values it gives this error :
"Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Leave From, Leave To]: [Leave From, Leave To] Error is in expression '{!Submit}' in component in page leave_form: Class.Leave_Page_Controller.Submit: line 30, column 1"

  • 1
    What exactly is your problem? I don't see any specific problem here. Perhaps you could share some more code with us? – sfdcfox Sep 30 '19 at 12:28
  • 1
    Hi Laxmi, is your issue in passing the date value over to your Apex controller? It would be helpful to see the Apex side of your code to help troubleshoot. – nbrown Sep 30 '19 at 12:49

Your Answer

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

Browse other questions tagged or ask your own question.