Page 1 of 1

Replacing characters in an "ask" editor variable

Posted: Wed Mar 26, 2014 4:48 pm
by stdu
Hi!

Were using the editor variable in our framwork (for Author 14.2)

Code: Select all

${ask('Input URL', url, '')}
to offer our users the possibility to inserts links in documents. Sometimes the URLs contains the character "&". If this is the case, the functions prohibit the insertion (due to XML rules). It would be nice if the function could replacing "&" with "&" (and other possible problematic characters) to allow such actions. Is this possible?

Thx & Greets,
Stefan

PS: It seems, that with the type "generic" Oxygen checks also the insertion of non-valid characters.

Re: Replacing characters in an "ask" editor variable

Posted: Wed Mar 26, 2014 5:28 pm
by Radu
Hi Stefan,

I think you are right, I added an improvement request to our issues list to XML-escape the URL's value when the $ask editor variable is used from a code template or as a parameter to an AuthorOperation. You are using it as a parameter passed to an Author Operation, right?

As a workaround of course you can implement your own Author Operation and show your own Java Swing-based dialog to the user, then use our API to insert the value.

About this remark:
It seems, that with the type "generic" Oxygen checks also the insertion of non-valid characters.
Do you mean that when you use something like:

Code: Select all

${ask('Input text', '')}
you would also want the inserted characters to be automatically XML-escaped?

Regards,
Radu

Re: Replacing characters in an "ask" editor variable

Posted: Thu Mar 27, 2014 2:06 pm
by stdu
Hi Radu,

thx for adding the feature request! That would be great!
And you're right: we're using it as parameter passed to an Author Operation (SourroundWithFragment). At the moment I think, that all content in ask-Variables should be escaped, because it has to due to XML rules ... or is there any counter-argument?

Thx & kind regards,
Stefan

Re: Replacing characters in an "ask" editor variable

Posted: Thu Mar 27, 2014 3:12 pm
by Radu
Hi Stefan,

We'll consider this, I assume that most of the times you use the $ask to request a value for a certain attribute, right?

Regards,
Radu

Re: Replacing characters in an "ask" editor variable

Posted: Tue Apr 15, 2014 3:03 pm
by stdu
Hi Radu,

sorry for the late reply - I was in holiday for the last two weeks.
And, yes, that's right: we use it most of the times for attribute values.

I've seen your update changelog from yesterday:
Author/Form Controls: Entering XML reserved characters (&, <) in a form control that is editing the value of an attribute, would result in an invalid XML document.
Do you have already solve this issue with the last update?

Greets,
Stefan

Re: Replacing characters in an "ask" editor variable

Posted: Tue Apr 15, 2014 4:02 pm
by alex_jitianu
Hi Stefan,

That note actually refers to a different issue: while editing attributes with form controls, reserved characters (&, <) were not escaped. The fix to the issue from this thread is not present in the update.

Best regards,
Alex

Re: Replacing characters in an "ask" editor variable

Posted: Fri May 23, 2014 2:09 pm
by Radu
Hi Stefan,

Oxygen 16.0 which was released a couple of days ago should have a fix for your improvement request to automatically escape content inserted by the user using the ask editor variable prompt dialog.

Regards,
Radu

Re: Replacing characters in an "ask" editor variable

Posted: Wed Feb 03, 2016 1:26 pm
by stdu
Hi Radu,

in 17.1 the Author denied to insert unescaped ampersands (&), but doesn't replace them? Is this intended? Or do I have to activate some flag elsewhere?

Kind regards,
Stefan

Re: Replacing characters in an "ask" editor variable

Posted: Wed Feb 03, 2016 2:47 pm
by Radu
Hi Stefan,

Just tested an Author InsertFragmentOperation with an XML like:

Code: Select all

<p audience="${ask('Message', url)}"/>
and you are right, the & should be automatically escaped.
We'll fix this, I will try to integrate a fix also in the next Oxygen 17.1 minor bug fix release.
I'll update this thread when a fix is available.

Regards,
Radu

Re: Replacing characters in an "ask" editor variable

Posted: Wed Feb 03, 2016 4:10 pm
by stdu
Cool, thank you, Radu!

Re: Replacing characters in an "ask" editor variable

Posted: Tue Feb 09, 2016 11:49 am
by ionela
Hi,

Just to update the thread, this problem has been resolved in the latest maintenance build of oXygen 17.1, 2016020417(released on February 5th):
Author: URL values returned by the ${ask} editor variable used in AuthorOperation parameters were not automatically XML-escaped
You can download it from our web site:
http://www.oxygenxml.com/download.html

The list of bug-fixes can be found here:
http://www.oxygenxml.com/build_history.html#2016020417

You can follow the release/build RSS feed here:
http://www.oxygenxml.com/rssBuildID.xml

Let us know if you encounter further problems with this new build.

Regards,
Ionela