Strings with 0x in it won't work with as custom validation params
See original GitHub issueAre you requesting a feature, reporting a bug or asking a question?
reporting a bug
What is the current behavior?
You create a survey with an input and custom validator for that input. You put in a string with 0x in the survey input (for example an ethereum address). The paramater that goes into the custom validator is not what was in the input. It appears as if it is put in hexadecimal form.
What is the expected behavior?
You create a survey with an input and custom validator for that input. You put in a string with 0x in the survey input (for example an ethereum address). The paramater that goes into the custom validator should be exactly what was typed in the input.
How would you reproduce the current behavior (if this is a bug)?
Create a new survey with a custom validator and log the paramaters.
Provide the test code and the tested page URL (if applicable)
Tested page URL: https://jsfiddle.net/vdk93zL8/
Test code
try inputing 0xbe0eb53f46cd790cd13851d5eff43d12404d33e8
<div id="surveyContainer"></div>
debugger;
Survey.StylesManager.applyTheme("bootstrap");
var surveyJSON = {"pages":[{"name":"page1","elements":[{"type":"text","name":"question1","title":"What's your ethereum address?","validators":[{"type":"expression","expression":"validate({question1})"}]}]}]}
function sendDataToServer(survey) {
survey.sendResult('7944a1fa-e257-46a5-9c71-6522827ff3c9');
}
var survey = new Survey.Model(surveyJSON);
$("#surveyContainer").Survey({
model: survey,
onComplete: sendDataToServer
});
function validate(params) {
alert(params[0]);
return true;
}
Survey.FunctionFactory.Instance.register("validate", validate);
Specify your
- browser: chrome
- browser version: 77.0.3865.90
- surveyjs platform (angular or react or jquery or knockout or vue): jqury
- surveyjs version: 1.1.13
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Custom validation for RequestParam doesn't work with Spring ...
I can't make custom validation working with Spring MVC. I implemented own annotation for parameter and custom validator for it (all is given ......
Read more >go-playground/validator - Gitter
Hi, I want to use 'hexadecimal' tag to check correct hex string. But we get value which starts with '0x'. But 'hexadecimal' tag...
Read more >invalid genesis file: missing 0x prefix for hex data · Issue #14573
We have noticted if you change the extraData parameter to an empty string (or 0x0 I believe) then the genesis block can be...
Read more >A Guide to the Newer Python String Format Techniques
In the last tutorial in this series, you learned how to format string data using the string modulo operator. In this tutorial, you'll...
Read more >Parameters — Click Documentation (8.1.x)
To implement a custom type, you need to subclass the ParamType class. Override the convert() method to convert the value from a string...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@MarissaHudson I made the fix. I did not happy with the work-around, but I could not came with something better. We are going to release new minor version today. The fix will be there.
Thank you, Andrew
@MarissaHudson Yes, indeed. I forgot to use my new function in expression engine. I have added a new unit test and fix it. It will work fine from v1.1.15 that we will likely release next Tuesday. Sorry about that.
Thank you, Andrew