Skip to content

Wordpress surveyjs plugin - Cannot change textftield value #10

@Chatzimina

Description

@Chatzimina

Hello everyone,

I have a weird problem. I have used surveyjs plugin with a wordpress site (version : 5.1.1) and I have created a quesionnaire but I would like to keep which user is completing the questionnaire. I created a textfield and tried to complete automatically (because the user may not complete it properly) it by using this code:

  var textfield = document.getElementsByClassName('sv_q_text_root')[0];
  textfield[i].value = '<?php $current_user = wp_get_current_user(); echo $current_user->user_email ;?>';

Although I see the email shown inside the textfield when I save the survey it is not saved in the results. Then if I add by pressing in the keybord an extra letter after the email the result is saved. For example if I add by javascript the "[email protected]" in the textfiled it is not saved but if i write a letter by keyboard after it like this "[email protected]" it is saved.

Then I tried to simulate a keyboard press like this :

   jQuery(function($) {
      $( "#sv_q_text_root" ).trigger(
      jQuery.Event( 'keyup', { keyCode: "65", which: "65" } )
   )});

but still it doesn't save.
If also you know another way to save the users with the results, I couldn't find something about wordpress.
Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions