Additional form button

sunnyjey

Active Member
I want to display additional Login Button in the Form for the Guest user. On click it should redirect to the login page.

I have created the addition button with Layout overide:

components/com_fabrik/views/form/tmpl/mytemplate/layouts/form/fabrik-custom-button.php

Code:
?php

defined('JPATH_BASE') or die;
$d = $displayData;
?>

<?php
if ($d->formModel->getId() == X) {
    ?>
<button type="submit" class="btn btn-primary button save" name="Login">Login</button>
<?php
}
?>

And created a new js file:
./component/com_fabrik/js/form_X.js

Code:
var url = 'index.php?loginpage;

requirejs(['fab/fabrik'], function() {
   Fabrik.addEvent('fabrik.form.submit', function (form, e, btn) {
      if (btn.name === 'Login') {
         Fabrik.getWindow({
   id: 'some-unique-id',
   contentURL: 'url,
   loadMethod: 'xhr',
   title: 'Login'
});
      }
   });
});

I know above code is wrong. Please help

Secondly how do I show this button to the Guest and Hide for Logged users ?
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top