redirect via button javascript

Status
Not open for further replies.

uschmi

Member
I have 2 tables containing employee data.
In form1 for the employee data, there is a button which opens form2 containing other data of the same employee.
I?m using javascript / onClick for this.
This is working fine in a form but the button does not work in details view (no error, just nothing).
Could someone help to make this button work in details view too?

Code:
var mitarbeiter =Fabrik.getBlock('form_3').formElements.get('vk_vertraege___madaten_id').getValue();
var url ='/index.php?option=com_fabrik&view=form&Itemid=115&formid=1&rowid='+mitarbeiter+'-'+mitarbeiter+'&listid=1';
window.open(url);
 
I have 2 tables containing employee data.
In form1 for the employee data, there is a button which opens form2 containing other data of the same employee.
I?m using javascript / onClick for this.
This is working fine in a form but the button does not work in details view (no error, just nothing).
Could someone help to make this button work in details view too?

Code:
var mitarbeiter =Fabrik.getBlock('form_3').formElements.get('vk_vertraege___madaten_id').getValue();
var url ='/index.php?option=com_fabrik&view=form&Itemid=115&formid=1&rowid='+mitarbeiter+'-'+mitarbeiter+'&listid=1';
window.open(url);
Your mistake is putting the button as an element in the form. In details view all elements are read-only and the user cannot interact with them - hence "(no error,just nothing)". My guess is that the fabrik element javascript plugin does not get run in a detail view - assuming that is where you are adding the javascript??? If so - try creating a stand-alone javascript file for that form - this way you have more control. (And another reason why I rarely use the fabrik javascript option.)

I have a few other possible solutions in mind. Like show (and change the name of?) one of the form action buttons (one that would show in both edit and details view) and have a javascript onclick event for that button that does what you are now doing elsewhere. (As much as I always hated coding javascript - for me, jQuery is wonderful.)
 
Status
Not open for further replies.

Members online

No members online now.
Back
Top