How to prevent script running when a page loads


I am a consultant working at WorldPay in the UK. WorldPay are using Confluence 5.0 with the sql-script, run, and script plugins. WorldPay has paid for the sql-script pugin, and is evaluating the other two.

This is the markup:

<ac:macro ac:name="panel">
    <p>Moved to own space: <ac:link>
        <ri:page ri:content-title="Reference Data Home" ri:space-key="RDS"/>
<p> </p>
<h2>BobSwift SQL Macro</h2>
<h4>The following table selects all records from the tmpControl table in the RelMgr MySQL database on UKDC1-TC-JIR02</h4>
<ac:macro ac:name="sql">
  <ac:parameter ac:name="dataSource">relmgr</ac:parameter>
  <ac:parameter ac:name="atlassian-macro-output-type">BLOCK</ac:parameter>
  <ac:plain-text-body><![CDATA[select * from tmpControl]]></ac:plain-text-body>
<p> </p>
<h3>Add or update values</h3> <ac:macro ac:name="run"> <ac:parameter ac:name="replace">A:default:Name,B:default:Value</ac:parameter> <ac:parameter ac:name="id">SQLTest1</ac:parameter> <ac:parameter ac:name="autoRun">false</ac:parameter> <ac:parameter ac:name="titleReset">Clear</ac:parameter> <ac:parameter ac:name="exportVersion">replace</ac:parameter> <ac:parameter ac:name="atlassian-macro-output-type">BLOCK</ac:parameter> <ac:parameter ac:name="titleRun">Update</ac:parameter> <ac:rich-text-body> <ac:macro ac:name="sql"> <ac:parameter ac:name="dataSource">relmgr</ac:parameter> <ac:parameter ac:name="atlassian-macro-output-type">BLOCK</ac:parameter> <ac:plain-text-body><![CDATA[insert into tmpControl set name='$A', value='$B']]></ac:plain-text-body> </ac:macro> </ac:rich-text-body>

The bold section is run whenever the page is loaded or refreshed (e.g. whenthe Preview button is pressed). How do we make it so that the macros in the highlighted section are run only when the button is pressed, i.e on demand?

Many thanks,

Steve Brown

1 answer

To be clear the macro is the one after the "Add or update values" heading.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published Thursday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

354 views 0 6
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you