surveyjs / surveyjs-wordpress Goto Github PK
View Code? Open in Web Editor NEWExample of integration SurveyJS: Survey Library and Survey Creator into WordPress
Home Page: https://wordpress.org/plugins/surveyjs/
Example of integration SurveyJS: Survey Library and Survey Creator into WordPress
Home Page: https://wordpress.org/plugins/surveyjs/
The back button on pages, Edit, Results, and Clone returns the user to a URL that is hardcoded as <button onclick="window.location = '/wp-admin/admin.php?page=sjs-main-menu'">< Back</button>
Removing styling from button for readability.
I believe this would be a more dynamic way of returning the user to the admin page.
<button onclick="window.location = '<?php echo get_admin_url() ?>?page=sjs-main-menu'">< Back</button>
I bring this up because if a developer is working in a development environment then they may have a URL that looks like localhost/wordpress/site2/wp-admin/admin.php?page=sjs-main-menu
as opposed to assuming the URL: localhost/wp-admin/admin.php?page=sjs-main-menu
.
The problem is that in the current implementation of onclick="window.location = '/wp-admin/
will return the user to the URL localhost/wp-admin/
every time, even if it should return them to the URL localhost/wordpress/site2/wp-admin/
.
in the new gutenberg editor there is no Add Survey
Button.
Hard to find out the right shortcode, like [Survey id="1" name="My Grand Survey"]
and add it with the Gutenberg Shortcode Block.
survey-creator.min.js
file to last version of SurveyCreatorP.S. Also remove surveyeditor.min.js
if it is unnecessary
T17300 - How to activate license in wordpress
https://surveyjs.answerdesk.io/internal/ticket/details/T17300
I've been trying to use a hook to send an email when the results are saved
add_action('wp_ajax_SurveyJS_SaveSurvey', 'my_SaveSurvey', 9);
However it's not firing.
Currently I'm using this workaround but it's less than ideal.
if($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['Json']) && isset($_POST['SurveyId'])) {
my_SaveSurvey();
}
Any help would be appreciated.
Hi,
thank you for this addon, it’s good idea.
I have found an bug with woocommerce when surveyjs is actived
the zone (product type) is hidden when surveyjs is actived.
without surveyjs: http://zupimages.net/viewer.php?id=18/22/d1hv.png
with surveyjs: http://zupimages.net/viewer.php?id=18/22/p07p.png
it's same question from https://wordpress.org/support/topic/bug-with-woocommerce-7/
Thanks
I have been testing surveyjs-wordpress for quite some time now. Overall I really like it. But I am still missing some options.
I think it would be great if one could treat intro and outro for a survey as real html pages. That way you could apply different background images. BTW the completed html option doesn't work for me. I can't add HTML just plain text. If one could add background images per page, that would be awesome!
And I would really like it, if after I pressed next in a survey, there would be a smooth scroll upwards. Not sure if this deserves it's own issue.
Line 1 in 065cbb6
It would be very handy to be able to copy a survey from the mysurveys view. So one could create a survey as a template and then copy it when needed.
Using a file input, the form gets submitted as base64 json, but results get cut off at ~ 64kb.
To allow larger file uploads, they should be uploaded via the .onUploadFiles hook.
I.e. by opening up the existing SurveyJS_UploadFile api call or adding another one survey submissions.
I was wondering why there were so many js files being parsed on my WP site and figured, that if the surveyjs plugin gets activated, all the included js files in the WP dist directory are being loaded. Usually only enqueued scripts should be added, but as soon as surveyjs is activated, all (!) of them are included.
I did a bit of digging and found this post where the last post identifies register_block_type
as the culprit. I did a quick search and found that the correct editor_script
is used. Any idea what else might cause that?
Best regards,
Matthias
Hi,
when trying to show the results of a survey in the Wordpress/SurveyJS backend, it only shows the title and a blank page.
The browser's error log shows the following message:
Uncaught SyntaxError: JSON.parse: bad escaped character at line 1 column 280 of the JSON data
data https://example.com/wp-admin/admin.php?page=surveyjs_results&id=5&name=RaS2024_final_de-en:444
<anonymous> https://example.com/wp-admin/admin.php?page=surveyjs_results&id=5&name=RaS2024_final_de-en:443
[admin.php:444:41](https://example.com/wp-admin/admin.php?page=surveyjs_results&id=5&name=RaS2024_final_de-en)
Fortunately, I was able to locate the wp_sjs_results
table, so I can see the raw JSON data. But I'd like to be able to export the entries as CSV.
Any hints what the "bad escaped character" could be or how to look for it? (I have no clue what "column 280" could mean).
Hi SurveyJS Dev Crew,
I've had a lot of fun putting together surveys with this plugin over the past few weeks! The library makes it very straightforward to develop surveys with complex logic and I'm grateful for the work ya'll have put into it!
I had been using the surveyjs.io site to host my surveys, though I just recently made a survey that asks about some sensitive data.
I decided to check out the WP Plugin to host the results on my WP instance. In using the WP plugin I noticed that in the plugin settings the "Bootstrap framework" option is missing:
whereas it's present on the site in the equivalent drop-down:
Is this by design?
The plugin changes style in ALL the Wordpress admin. So, to avoid it, you can add this piece of code in initializer.php
public function enqueue_admin_scripts() {
if ( isset( $_GET["page"] ) &&
($_GET["page"] == "sjs-settings" ||
$_GET['page'] == "sjs-main-menu" ||
$_GET['page'] == "surveyjs_editor" ||
$_GET['page'] == "surveyjs_results"
)
) {
... (all css and jquery files)
}
}
with the plugin installed all pages contain all surveys as a java script variable:
<script type='text/javascript'>
/* <![CDATA[ */
var surveys = []
...
thats wrong
T16470 - Upload image in Wordpress instead of JSON
https://surveyjs.answerdesk.io/internal/ticket/details/T16470
Hi,
sorry for submitting yet another issue. After fiddleing about with the timestamp thing (#48 / this comment), which I implemented semi-successfully with the expression currentDate()
, my form stopped storing any submissions to the database altogether (other forms still worked fine).
I tried debugging it for a few hours — deleting the expression, copying the form, testing different browsers and devices. I couldn't get it to work again, though. The worst thing is that you didn't get a clue as a user, that your entry wasn't saved (no error message, nothing).
Trying this out on a live site in the middle of our conference registration phase running was a bad idea, obviously, but ... I also lost my confidence in the SurveyJS wordpress plugin at that point. 😞
In the end I spent the night recreating the form with ninjaforms. Now it's ugly, but it works again. Plus I have the automatic email functionality (= feature suggestion) that is great to give participants instant feedback as well as for backup, in case the stored submissions become corrupted.
To end this on a less anecdotal note: Here is my form JSON, if you'd like to have a look at it to see whether you can recreate the bug: ras24-survey.json
Best, kuchengrab
My WP survey has dynamic panels which I am going to need to "flatten" in order to make a sensible report. First step is to get the JSON of all results.
If I click the Copy button I do not get JSON. I get a mixture of text and json as below (is an abbreviated version of data from the test survey results). Any way to get clean JSON? Am I missing something.
‹ Kindlehill School, Blue Mountains — WordPress
question9 question6 For this student ... To what extent is the school meeting your expectations of your child/young person’s education What are your thoughts about the volunteer work you do at the school? Are you intending to send your child to Kindlehill High School? Whatever your response above, please expand on your thinking about High School. How would you rate your expectation of administration in terms of: Do you read? What does Kindlehill do well?
Test 1 Show in Survey
[{"question2":{"Row 1":"Column 2"},"question3":{"Row 1":"Column 1"}},{},{}] {"0":{"Column 2":"1","improvements":"ghjk ghjkghkjg"},"To what extent do you value the balance of thinking, feeling, doing (willing) in your child/young person’s education?":{"Column 3":"1","improvements":"bhj "}}
{snip....}
} {"Kindlings":"Sometimes","Fortnightly newsletter via email":"Always"} all Show in Survey
Thanks,
Murray
We built an ISO9001 assessment survey and it was like 170 kb. The MySQL table (sjs_my_surveys) field (json) for the survey json file is of type TEXT, which is maximum 64K.
The result was that the survey was impossible to save on WP.
Maybe the field should be of type MEDIUMTEXT, this was our workaround (ALTER sjs_my_surveys TABLE)
T15905 - Worsdpress plugin
https://surveyjs.answerdesk.io/internal/ticket/details/T15905
The following issue occurs in SurveyJS Wordpress Plugin: the {CORRECTANSWER} variable is not converted to an actual value. It was reported at T10786 - {correctAnswer} not work.
I believe the issue occurs due to the outdated SurveyJS library version.
Thanks for the plugin. Very helpful.
I needed to set some CSS to override the WP theme and to better format the matrix tables I am using. I did that by adding the following to surveyjs/survey.css
directly via the WP plugin file editor, which obviously has a downside if I update the SurveyJS plugin.
.main_color tr:nth-child(2n) { background-color: #f8f8f8 !important; }
.sv_header { background-color:#75e3b0; }
.sv_q_matrix tr th:first-child{ text-align:left !important; }
.sv_q_matrix tr td:first-child{ text-align:left !important; }
.sv_q_matrix th { text-align:center !important; }
.sv_q_matrix td { text-align:center !important; }
I was wondering whether you might consider adding some php to look for (say) surveyjs/custom.css
and load it if the file exists. I am assuming the WP update process would not delete all files so this would remain in effect after any update.
I could envisage a similar JS file that could be called as a hook immediately before the
jQuery("#surveyElement-<?php echo $id ?>").Survey({model: survey<?php echo $id ?>, css: customCss});
passing the model JSON so last minute customisations could be done. eg to add other event listeners hooking into custom js code.
Just a thought to make this even more useful than it is!
Thanks,
Murray
see https://surveyjs.answerdesk.io/ticket/details/T6087 for details
No images in the Screenshots readme section.
T17426 - Error "Survey Is Loading"
https://surveyjs.answerdesk.io/internal/ticket/details/T17426
The following exception appears in a browser console:
Uncaught ReferenceError: theme is not defined
at Object.success (win/:431:39)
at c (jquery.min.js?ver=3.7.1:2:25304)
at Object.fireWith [as resolveWith] (jquery.min.js?ver=3.7.1:2:26053)
at l (jquery.min.js?ver=3.7.1:2:77782)
at XMLHttpRequest.<anonymous> (jquery.min.js?ver=3.7.1:2:80265)
Hi,
Thanks a lot for such a great plugin. I installed latest version from the store and noticed that the theme is not honored even after I change in the Settings menu.
Do I need to follow any steps after that?
Thanks,
Navneet
This is not related to the bug anymore, but I have a follow-up question (if it makes sense, I can also repost it as a new issue/suggestion):
Is it possible to order the entries by timestamp (or database id)? Alphabetic order of any field doesn't make much sense in our case (to track new registrations and send them confirmation emails). Looks like I would need to add the timestamp as a field in the survey or something to achieve that?
Originally posted by @kuchengrab in #47 (comment)
Hi,¨
in app.component.ts, in this method result.data has key value format,
surveyModel.onComplete
.add(result =>
this.submitSurvey.emit(result.data)
)
like {"question1":100,"myquestion2":"Yes"}, how can i have it like this json format:
{{
name:question1.
value: 100
},
{
name: myquestion1
value: yes
}
}
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
How to have the survey results sent to a database rather than sending them to the survey js plugin (sensitive data)
Thank you.
Hi there!
I already posted here but it doesn't seem to get the traction that I need ;)
In short: As the title Suggests, how can I add custom widgets in WordPress? I need a range-slider urgently and don't know where to put/include the js files
<script src="https://unpkg.com/[email protected]/distribute/nouislider.js"></script>
<script src="https://surveyjs.azureedge.net/1.5.17/surveyjs-widgets.js"></script>
Any pointers are appreciated!
Best regards
bug
When using the less than character in any of the input fields when configuring a survey the JSON becomes malformed as the character is wrongly encoded as an HTML entity.
You can use a less than or greater than character.
We encountered this using the WordPress SurveyJS plugin.
Sorry, don't have any repro at the moment.
T17592 - SurveyJs on wordpress
https://surveyjs.answerdesk.io/internal/ticket/details/T17592
If I have this in my survey JSON:
{
"type": "html",
"name": "question1",
"html": "<h4>Welcome!</h4>"
}
the resulting html in the survey is:
<div data-bind="html: question.locHtml.koRenderedHtml">Welcome!</div>
i.e. no html tags. I am assuming WP is doing that? Not sure what to do.
Any ideas?
Thanks,
Murray
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.