Template Prompts Not Working

Having trouble installing Oxygen? Got a bug to report? Post it all here.
atross13
Posts: 6
Joined: Wed Apr 04, 2012 9:28 pm

Template Prompts Not Working

Post by atross13 »

Hi, there,

I have success with editor variables in code snippets that will automatically populate (such as ${date(yyyy-MM-dd)} and ${date(MMMM dd, yyyy)}

However, when I have tried to implement document templates and code snippets that will produce a prompt upon run, these editor variables are placed into the document as text. I have followed the pattern from the help screens and manual, but to no avail:

${ask('user-message', param-type, 'default-value' ?)}
-->
${ask('What is your name?', generic, 'default' ?)}

I have tried many variations, but I cannot get values prompts at run time when I try to create new documents.

When reading through the sample code templates, I notice that not a single snippet uses ask prompts, instead only being code with a ${caret} placement. (Contrast those examples with the free NoteTab program, in which I was able to create numerous clip libraries and run prompts that make this free program in some ways much more robust with XML creation than what I have with Oxygen at present. I am crossing my fingers that it's a simple fix...)

I find this disappointing and frustrating. I am hoping there is a small step I'm missing along the way. I'd appreciate any advice from others who have solutions to offer!

Thanks!
Radu
Posts: 9449
Joined: Fri Jul 09, 2004 5:18 pm

Re: Template Prompts Not Working

Post by Radu »

Hi,

So from what I understand you tried to use the $ask editor variables in two contexts:

1) In the new file templates used to create new documents.

2) In new code templates used to insert small snippets of XML code.

(1) was not yet implemented but I added an improvement request and we'll update this thread when it happens.

(2) was implemented in Oxygen 13.0 so if you have an older version of Oxygen this would explain why ask editor variables in the content of code templates would not work for you.
Basically when editing a code template you have a drop-down button showing you the available editor variables and if the editor variable is contained in the list then it should definitely work.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
atross13
Posts: 6
Joined: Wed Apr 04, 2012 9:28 pm

Re: Template Prompts Not Working

Post by atross13 »

Thank you for your reply! I have the Editor 13.2 package, which I believe is the most current.

So you are saying that support for $ask within document templates has not yet been implemented for document templates? How very strange. I hope this is remedied soon. It was one of the most helpful features of NoteTab when managing a fleet of authors and editors. Thank you for submitted an improvement request. You will have many happy project managers, I imagine!

As to the code templates, aha! Following your suggestion, when I used the dropdown menu rather than typing the code myself, the $ask worked. But this is also strange, as the actual text (once I customized the message and input type) is the exact same as what I typed myself. I will use the dropdown from now on but is there a way to request this issue be looked at, as well?

Thanks again for your responsiveness!
Radu
Posts: 9449
Joined: Fri Jul 09, 2004 5:18 pm

Re: Template Prompts Not Working

Post by Radu »

Hi,
Following your suggestion, when I used the dropdown menu rather than typing the code myself, the $ask worked. But this is also strange, as the actual text (once I customized the message and input type) is the exact same as what I typed myself.
The samples which you posted in the first post contained an extra question mark character ? so this is why they did not work.

I think that you copy/pasted the question mark from our user manual where we intended it to signal that the last parameter was optional.
I guess we should have explained the third parameter as being optional in the user manual instead of adding that question mark there.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
atross13
Posts: 6
Joined: Wed Apr 04, 2012 9:28 pm

Re: Template Prompts Not Working

Post by atross13 »

I realized the third parameter was optional from the definition: "'default-value' - optional parameter. Provides a default value in the input text box." Adding a question mark *is* unnecessary, and rather misleading: "To prompt for values at runtime, use the ask('user-message', param-type, 'default-value' ?) editor variable." (http://www.oxygenxml.com/doc/ug-editorE ... lates.html)

Is it possible to create:

* Dropdown lists for users (e.g. an $ask prompt with controlled choices)
* A code template that supports multiple $ask requests

If not, I'd like to submit improvement requests.

Thanks again!
Radu
Posts: 9449
Joined: Fri Jul 09, 2004 5:18 pm

Re: Template Prompts Not Working

Post by Radu »

* Dropdown lists for users (e.g. an $ask prompt with controlled choices)
We already have an improvement request for this, I added your vote and we'll update the forum thread when it gets implemented.
* A code template that supports multiple $ask requests
Yes, this should be possible.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
atross13
Posts: 6
Joined: Wed Apr 04, 2012 9:28 pm

Re: Template Prompts Not Working

Post by atross13 »

Great on the dropdown lists improvement request! Crossing my fingers as such an improvement will allow me to better advocate that my colleagues get Oxygen XML.

As to the second, when I have multiple $asks (using the code template dropdown!) in a code template, it will only run the last $ask. Any advice?
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Template Prompts Not Working

Post by sorin_ristache »

Hello,
atross13 wrote:As to the second, when I have multiple $asks (using the code template dropdown!) in a code template, it will only run the last $ask. Any advice?
I created a code template with two ${ask} variables and Oxygen asked me to enter a value for each one with a separate dialog box. Please post here the entire content of your code template and specify the associated editor type (XML editor, XSL editor, all editors, etc) for reproducing the problem.


Regards,
Sorin
atross13
Posts: 6
Joined: Wed Apr 04, 2012 9:28 pm

Re: Template Prompts Not Working

Post by atross13 »

I figured out that the code templates break down when I include a comma in the values area of the ${ask} prompt, whether in real value or rendered value. I tried using HTML entity codes, but the code template still doesn't work. I've used code templates successfully in many variations, until I need commas in the values. Thoughts?
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Template Prompts Not Working

Post by sorin_ristache »

Hello,

Thank you for reporting this problem. Is the effect that you get the insertion of the template definition instead of the result of replacing the ask value? For example if I test a code template with the definition:

Code: Select all

<a>${caret}${ask('Message', combobox, ('value1':'rendered_value1'), 'Default_value')}</a>
but I modify it and insert a comma in either value1 or rendered_value1 the popup dialog box is not displayed anymore and the raw template definition is inserted at cursor location. We will fix this problem in a future version.

Please avoid using non-alphanumeric characters in an ${ask} parameter if you can until we fix the problem in a future version.


Regards,
Sorin
atross13
Posts: 6
Joined: Wed Apr 04, 2012 9:28 pm

Re: Template Prompts Not Working

Post by atross13 »

I am now working in 15.2 and the comma still breaks the $ask functionality. This should be a simple fix. When will you correct this problem?
Radu
Posts: 9449
Joined: Fri Jul 09, 2004 5:18 pm

Re: Template Prompts Not Working

Post by Radu »

Hi,

Sorry about this, we'll try to fix this in Oxygen 16.1.
In the meantime, there are more than one character which are rendered as comma by a certain font.
As a workaround you could try to copy from the code block below and use this symbol:

Code: Select all

It is the small comma character:

http://www.fileformat.info/info/unicode ... /index.htm

It should render as a comma but its character code equivalent is different from the one of the standard comma and Oxygen should be able to parse it properly.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Radu
Posts: 9449
Joined: Fri Jul 09, 2004 5:18 pm

Re: Template Prompts Not Working

Post by Radu »

Hi,

This issue is fixed in Oxygen 16.1 which was just released.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply