I've created a Blueprint Wizard and I've been trying to get the autocomplete-user field to work but despite being able to successfully search for users in the wizard, when the draft is created and published, the user name is still inserted as plain text.
I've spent a good while looking through the existing questions and answers and although there's lots of questions on the subject, I still haven't been able to resolve the issue.
The relevant section in my soy template is as follows:
<div class="field-group">
<label for="techreview">{getText('my.blueprint.form.label.title.techReview')}</label>
<input id="techreview" type="text" class="text long-field autocomplete-user" data-none-message="No users found" data-template="{literal}{username}{/literal}" placeholder="{getText('blueprint.form.name-label.placeholder')}" name="techReview">
</div>
My post-render function is: (I've tried with both UserOrGroup, MultiUser and both of them individually with no change in success).
wizard.on('post-render.ECOInfoForm', function(e, state){
AJS.Confluence.Binder.autocompleteMultiUser();
AJS.Confluence.Binder.autocompleteUserOrGroup();
})
My XML:
<tr>
<th>Technical Reviewer</th>
<td><at:var at:name="techReview"/></td>
</tr>
I've also tried replacing the above with:
<tr>
<th>Technical Reviewer</th>
<td><ri:user ri:username="techReview"/></td>
</tr>
and that didn't work either. I'm guessing because this looks for a username of 'techReview'? Rather than actually replacing it with the given username from the soy.
What am I doing wrong? Sadly, I couldn't seem to find any good examples on this anywhere. Any help would be much appreciated!
I was able to answer my own question eventually.
My XML:
<tr>
<th>Technical Reviewer</th>
<td><at:var at:name="vTechReviewMention" at:rawxhtml="true"/></td>
</tr>
And in my ContextProvider Class:
String vTechReview = (String) blueprintContext.get("vTechReview");
context.put("vTechReviewMention", "<ac:link><ri:user ri:username=\"" + vTechReview + "\"/></ac:link>")
And this worked for me. The magic was adding the <ac:link> tags around the user tags. Hope this helps anyone else who struggles to get this working.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.