Macro input Parameters with dependecies

Hello,

I’m currently trying to write a xhtml-macro Plugin and finding it pretty difficult to figure out how to customize anything.
What I’m trying to do is make the user select a space and then make a list of all pages in there(as another input field, or many).
I thought maybe this video would help me: https://www.atlassian.com/company/about/events/atlascamp/2010/day2/making-confluence-macros-easy

The guy kinda teases parameter “dependencies” but I have no clue how to use this, or if it even fits my needs.

I have somthing like this in mind:

var jsOverrides = {
        "fields" : {
            "string" : {
                "Bereich" : function(params){
                    var options ={
                            
                    }
                    var somefield = AJS.MacroBrowser.ParameterFields["confluence-content"](params, options);
                    field.setValue(somefield.name);
                    return field;
                }       
             }
        }
    };

AJS.MacroBrowser.setMacroJsOverride(“thisParamMacro”, jsOverrides);

But I am actually not that good with JavaScript and can’t find any Atlassian documentations on this… really disappointing.
If there are Java solutions I would gladly take them as well.

Thanks in advance.

You’re going to need to use JS to achieve this … add in your macro override function and pop a breakpoint into it and then start poking around in the JS to get your head around what’s there … there is no documentation for this part of confluence (as far as I’ve seen)

1 Like

I kinda solved this by using a workaround. This did not give me real dynamic functionality, but I was able to fit the solution to my needs.

So what I basically did was to bind an autocomplete event to the field I was trying to listen to. When filled my JavaScript would add checkboxes, in my case, to the Form using AJS. The new Checkboxes sadly weren’t recognized as Macro Parameters but I addad some hidden text fields, which the checkboxes now fill on check.

If any questions arise I will gladly answer.