Can't pass the switch value in my form

Dear support,


I have an ejs-switch element in my page.

However, when I submit the form I can't get the value of it.


Can you help me ?


Thank you un advance ! 


Attachment: Update_17ccc899.zip

3 Replies

AS Aravinthan Seetharaman Syncfusion Team July 14, 2021 02:48 AM UTC

Hi Sandra, 
 
Thanks for contacting Syncfusion Support. 
 
We have checked your query. We can able to resolve this issue by using v-model in Switch component. Please refer the below code snippet and sample. 
 
 
<ejs-switch v-model="value" :checked="value" ref="switch" ></ejs-switch>

export default { 
  data() { 
    return { 
      value: true, 
    }; 
  }, 
btnClick: function (event) { 
      var switchObj = this.$refs.switch; 
      console.log(switchObj.checked); 
    }, 
  }; 
 
 
 
For more details, please refer the below UG link. 
 
 
Please let us know if you have any concern on this. 
 
Regards, 
Aravinthan S




SB Sandra Bordier July 16, 2021 01:30 PM UTC

Thank you very much.


It works perfectly when I create an item.


However, when I want to update an item and need to bind the ejs-switch element it doesnt work anymore.


Here is my code, can you help me ?


Best regards ,




Attachment: update_5df59646.zip


AS Aravinthan Seetharaman Syncfusion Team July 20, 2021 03:56 AM UTC

 
Thanks for the update. 
 
We have checked your query. We can able to update the Switch state by using value property. Please check below code snippet and sample. 
 
<ejs-switch 
              v-model="value" 
              :checked="value" 
              ref="switch" 
            ></ejs-switch> 
 
. . .  
methods: { 
    btnClick: function (event) { 
      var switchObj = this.$refs.switch; 
      console.log(switchObj.checked); 
    }, 
    toggle: function () { 
      this.value = !this.value; 
    }, 
  }, 
 
 
 
Could you please check the above details and get back to us, if you need assistance on this. 
 
If we misunderstood your requirement, please share more details that would be great help for us to proceed further. 
 
Regards, 
Aravinthan S 


Loader.
Up arrow icon