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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Jul 10, 2018 in Marketplace Apps

If you’re an Atlassian app developer, you’ll want to know about Atlas Camp!

This September 6-7, hundreds of Atlassian App developers will flock to Barcelona Spain to build skills, discover product roadmaps, meet face-to-face with the Atlassian team, and learn how to extend t...

160 views 0 4
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