Page 1 of 1

Why does button "onclick" execute a Submit on Bug Report page

Posted: 24 Sep 2020, 18:46
by mantisNoob2
I need to autofill a field in the bug report page based on the input from another field. I figured an easy way to trigger the update is by adding an update button in bug_report_page.php. However, every onclick method I have tried simply executes the bug_update.php, and attempts to submit the bug.

I tried calling a method that I added to custom_field_api.php.

I tried running a separate php document.
<input type="submit" class="btn btn-secondary btn-sm" value="Get Hours" onclick='get_support_hours.php' </input>

<button onclick="window.location.href='';">Click Here</button>

I tried a javascript function.
<button type="submit" onclick="myFunction()">Get Hours</button>

<script type="text/javascript">
function myFunction() {
<?php echo "hello" ?>

I also tried using ajax. Everything I tried causes my button to act as if it is the existing Submit button. Please excuse my ignorance, but why is this, and how can I get around it?

Thanks in advance!