Page 1 of 1

Custom button no functioned

Posted: 2021-02-26 21:42
by ayussuf
Hi,

I want to make a button on Detail View and use it to open other table based on the data in current table. But when I click the button it just refresh the current table.

What is the problem?

My code is like this, on footer-extra.php:

Code: Select all

var url = $j('#Penilaian_Penyelia_link').attr("href");
var pid = <?php echo $PenyeliaID;?>;
var url2 = url + "addNew_x=1&filterer_penyelia=" + pid;
$j('#Penilaian_Penyelia_link').attr("href",url2)
				
$j('#Pengajaran_dv_action_buttons #deselect').before('<button id="penilaianpenyelia" class="btn btn-success" type="submit" name="insert_x" value="1" onclick="location.href=\'' + url2 + '\'"><i class="glyphicon glyphicon-plus-sign"></i> Penilaian Penyelia</button>');
				
//The button look like this:
//<button id="penilaianpenyelia" class="btn btn-success" type="submit" name="insert_x" value="1" onclick="location.href = 'Penilaian_Penyelia_view.php?filterer_tarikh_tajuk=1&amp;addNew_x=1&amp;filterer_penyelia=2';"><i class="glyphicon glyphicon-plus-sign"></i> Penilaian Penyelia</button>

Re: Custom button no functioned

Posted: 2021-02-26 21:55
by pbottcher
Hi,

try

Code: Select all

$j('#Pengajaran_dv_action_buttons #deselect').before('<button id="penilaianpenyelia" class="btn btn-success" type="submit" name="insert_x" value="1" onclick="event.preventDefault();location.href=\'' + url2 + '\'"><i class="glyphicon glyphicon-plus-sign"></i> Penilaian Penyelia</button>');

Re: Custom button no functioned

Posted: 2021-02-26 23:36
by ayussuf
Wow... it's works... thank you very much..