Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

User macro with button onclick not found

Maike September 22, 2022

Hi,

I have a quite complex user macro for a custom user search. I tested it with some hard coded JSON but now working with my api some parts wont work.

F.e. i need a button to run the search but my consol tells me:

Screenshot 2022-09-22 161931.png

it is there and i have no problems on my localhost.

<div class="div_searchbutton">
                    <button type="button" onClick="smalSearch()" class="button_search"><div id="SearchButtonText">Search&#x1F50E</div></button>
                </div>  
        async function smalSearch(){
            var smalSearchBar = document.getElementById("smalSearchBar");
            var searchvalue = smalSearchBar.value;
   
            if(searchvalue != null && searchvalue != ''){
                smalSearchBool = true;
                var smalSearch = "freetext="+ searchvalue;
                smalSearch =smalSearch.replace(/#/g,"");
                var table = document.getElementById("table_searchresultAddress")
                if(table.children.length <2){
                    const xy = await fetch(apiLinkBase+ 'Person/GetAdresses/?'+ smalSearch);
                    var myjson = await xy.json();
                    personJSON = myjson;
                     LoadSearchResultAdress();
                     var tablePC =document.getElementById("table_searchresultPresence");
                 OpenModal();
            }
            }else{
                alert("Please enter query. \nBitte Suche eingeben.")
            }
        }

Another problem is that my css is overwritten by some confluence rules but thats not the big problem. 

1 answer

0 votes
Zoriana Bogutska_Adaptavist_
Atlassian Partner
September 29, 2022

Hi @Maike 

If you are interested in ready to use solution, you can try apps from Atlassian marketplace. 

For example, Content Formatting Macros for Confluence allows you to add button or search box macros to your confluence pages.

If you are interested and have questions - let me know, this app was developed by my team.

Maike January 19, 2023

Hi @Zoriana Bogutska_Adaptavist_ 

while yes that's sounds great, I needed to iterate over data that was not in Confluence. 

But thanks.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events