Issue T1245
Visible to All Users

Adjusting property value in event onPropertyValueChanging

created 6 years ago

Hi,

I want to help the user enter a correct property value in the editor by trimming away spaces from the value.
But in the event onPropertyValueChanging, I cannot get the options.newValue to change the value of the property. And changing the options.obj directly does not work either.

Answers approved by surveyjs Support

created 6 years ago

Hello Natalie,
The following code should work:

JavaScript
editor.onPropertyValueChanging.add(function(sender, options){ if(typeof options.value == "string") { options.newValue = options.value.trim(); } })

Unfortunately, it doesn't work. We will investigate and comeback to you.

Thank you,
Andrew
SurveyJS Team

    Show previous comments (2)
    HH HH
    Hendrik Hansmeier 6 years ago

      Hi,

      what about adorners? The onPropertyValueChanging event does not fire if you change the title of the question or text of choices. Could you fix that, too?

      Thanks!

        Hello Hendrik,

        I've added the onPropertyValueChanging event call for adorners via the https://github.com/surveyjs/editor/commit/a32d86b0eb9f40f6670261927409cf264fbc7113 commit. Fix will be available in the nearest minor update.

        Thanks, Serge
        SurveyJS Team

        HH HH
        Hendrik Hansmeier 6 years ago

          Great, thank you!