How to set date value on the webform using javascript

Respondida

5 Comentários

  • Ifra Saqlain
    Community Moderator
    Most Engaged Community Member - 2022
    Most Engaged Community Member of The Year - 2021

    Add this to the variable:

    var _z = "Date "+$('#request_custom_fields_10113154225297').val();
    0
  • Amit

    I tried the above code, but the new date is not reflecting on the webform

    //matchRecord.purchaseDate --> is holding the date in format 2022-01-09      $('#request_custom_fields_10113154225297').val(formatDate(matchRecord.purchaseDate))
     var _z = "Date "+$('#request_custom_fields_10113154225297').val();

    0
  • Ifra Saqlain
    Community Moderator
    Most Engaged Community Member - 2022
    Most Engaged Community Member of The Year - 2021

    Can you explain more about your function (Web Form, Datepicker) ?

    now , you have data (stored in this variable _z) which is showing in console.

    use this _z variable and show data in the text field wherever your want.

    0
  • Amit

    I want that after the below line of code is executed the date should be displayed in the datepicker field.

     //matchRecord.purchaseDate --> is holding the date in format 2022-01-09
          $('#request_custom_fields_10113154225297').val(formatDate(matchRecord.purchaseDate))

    Currently it show blank.

    0
  • Ifra Saqlain
    Community Moderator
    Most Engaged Community Member - 2022
    Most Engaged Community Member of The Year - 2021

    Hi,

    Add this line at the end of your script.js file and let me know

    $('#request_custom_fields_10113154225297').attr('type', 'datetime-local');

     

    Screenshot:

    Output:

     

    0

Por favor, entrar para comentar.

Powered by Zendesk