It's not the same without you
Join the community to find out what other Atlassian users are discussing, debating and creating.
It appears that when using the user macro browser, default parameter values are not being passed to the user macro.
For example, when using the following:
## @param locations:title=Locations|type=string|required=false|default=all|desc=The locations to report on.
If the parameter value is left as the default all by the user, an empty/null value is passed to the user macro instead of the expected all.
This is an issue in Confluence 4.2 as well.
As a workaround, you can check each parameter for a null value using Velocity, and in that case apply your chosen defaults. From an end-user perspective things work as they should like this.
Example:
##Check default values (bug in Confluence - https://jira.atlassian.com/browse/CONF-23704) #if(!$paramoddcolor) #set($paramoddcolor = "ffffff") #end #if(!$paramevencolor) #set($paramevencolor = "ededed") #end
Hi Stuart,
I think you're hitting this reported bug https://jira.atlassian.com/browse/CONF-23704
I'm seeing the same behaviour as well, but have observed that if the value a user provides is the same as the default value then the value is not passed to the macro. If the user provides anything that is different to the default value then the user provided value is passed to the macro.
Atlassian didn't understand my problem here, so this may help to explain it:
The problem occurs when creating and using a User Macro. At the top of the macro code I define a parameter in the following way:
## @param locations:title=Locations|type=string|required=false|default=all|desc=The locations to report on.
The User Macro browser then understands that this particular macro can accept a parameter called "locations". As I have set a default value of "all" in the line shown above, the User Macro browser shows that "all" value by default in the field for that parameter. The problem occurs at this point if the user decides to go with the default value of "all" for this parameter. I am finding that in that case, the "location" parameter's default value of "all" is not being passed to the User Macro code. The value of the "location" parameter is only passed to the User Macro code if the user decides not to use the default value and gives their own value instead.
If predefined default values are not being sent to the User Macro code then what is the purpose of setting them?
Thanks
Just to add to this, an example of a macro that shows this problem is:
## @param myname:title=myname|type=string|desc=descy|required=true|default=MY DEFAULT VALUE <div id="$parammyname"> $parammyname </div>
This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.
Read moreHi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...
Connect with like-minded Atlassian users at free events near you!
Find a groupConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.
Start an AUGYou're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.