Since we still cant search this forum, I'll post the question here - not sure if it has been covered...
I have a jqButton defined and am trying to call a script for the onClick:
When it builds the page, I see in the source view that the function is built, but the button does not have an onClick property and the script never gets called. For that matter, I do not see the confirm("hey are you sure??") in there either...
So, how should we use AddScript to have a jqButton call a script?
I have a jqButton defined and am trying to call a script for the onClick:
PHP Code:
Dim b As New clsJQuery.jqButton("btnTestConnection", "Test Connection", IFACE_NAME, False)
b.AddScript("function userConfirm() { confirm(""hey - are you sure??""); }")
b.functionToCallOnClick = "userConfirm()"
sbtb.Append(b.Build)
PHP Code:
<script>
$(function() {
$('#btnTestConnection_ID598385').button({icons: {primary:'',secondary:''} });
$('#btnTestConnection_ID598385').click(function() {
userConfirm()
var theData='';
returnTrue = false
theData = theData+'&id='+this.id+'&btnTestConnection=Submit';
commonAjaxPost(theData,'My Plugin');
if(returnTrue) {
location.reload();
return false;
}
else {
return false;
}
});
});
</script>
<button type='submit' id='btnTestConnection_ID598385' name='btnTestConnection' >Test Connection</button>
Comment