Extend User plugin backend form in Octobercms
up vote
0
down vote
favorite
I extended the user plugin to include extra form fields:
UsersController::extendFormFields(function ($form, $model, $context) {
$form->addTabFields([
'mobile' => [
'label' => 'Mobile',
'type' => 'text',
'span' => 'storm',
'cssClass' => 'col-md-6',
'tab' => 'Security Profile'
],
'phone' => [
'label' => 'Phone',
'type' => 'text',
'span' => 'storm',
'cssClass' => 'col-md-6',
'tab' => 'Security Profile'
],
]);
});
The new fields working fine, but I want to do some javascript functions before saving the form, I searched google and octobercms Javascrip API but no luck.
Please Advice,
octobercms octobercms-plugins octobercms-backend
add a comment |
up vote
0
down vote
favorite
I extended the user plugin to include extra form fields:
UsersController::extendFormFields(function ($form, $model, $context) {
$form->addTabFields([
'mobile' => [
'label' => 'Mobile',
'type' => 'text',
'span' => 'storm',
'cssClass' => 'col-md-6',
'tab' => 'Security Profile'
],
'phone' => [
'label' => 'Phone',
'type' => 'text',
'span' => 'storm',
'cssClass' => 'col-md-6',
'tab' => 'Security Profile'
],
]);
});
The new fields working fine, but I want to do some javascript functions before saving the form, I searched google and octobercms Javascrip API but no luck.
Please Advice,
octobercms octobercms-plugins octobercms-backend
hmm if you can share what kind of functions you want to do then we can help you better :)
– Hardik Satasiya
Nov 19 at 6:40
it is a normal JS function$('#hiddenField').val(JSON.stringify(valueOfExtendedField));
and after the execution of the script it will submit the formm
– Ya Basha
Nov 19 at 21:30
I managed to do that in a frontend form as I have full control over the form, I created a button and did jQuery on click event and I did the logic inside the event function and submit the form, it worked as expected.
– Ya Basha
Nov 19 at 21:31
ok but seems in backend you can not control over code so not sure you are able to processhiddenField
value, I understand you want tocreate json
and need to use it inbackend
if you share how you intend to use this details in backend then I can help you : for ex like:storing in db table etc..
– Hardik Satasiya
Nov 20 at 10:56
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I extended the user plugin to include extra form fields:
UsersController::extendFormFields(function ($form, $model, $context) {
$form->addTabFields([
'mobile' => [
'label' => 'Mobile',
'type' => 'text',
'span' => 'storm',
'cssClass' => 'col-md-6',
'tab' => 'Security Profile'
],
'phone' => [
'label' => 'Phone',
'type' => 'text',
'span' => 'storm',
'cssClass' => 'col-md-6',
'tab' => 'Security Profile'
],
]);
});
The new fields working fine, but I want to do some javascript functions before saving the form, I searched google and octobercms Javascrip API but no luck.
Please Advice,
octobercms octobercms-plugins octobercms-backend
I extended the user plugin to include extra form fields:
UsersController::extendFormFields(function ($form, $model, $context) {
$form->addTabFields([
'mobile' => [
'label' => 'Mobile',
'type' => 'text',
'span' => 'storm',
'cssClass' => 'col-md-6',
'tab' => 'Security Profile'
],
'phone' => [
'label' => 'Phone',
'type' => 'text',
'span' => 'storm',
'cssClass' => 'col-md-6',
'tab' => 'Security Profile'
],
]);
});
The new fields working fine, but I want to do some javascript functions before saving the form, I searched google and octobercms Javascrip API but no luck.
Please Advice,
octobercms octobercms-plugins octobercms-backend
octobercms octobercms-plugins octobercms-backend
asked Nov 18 at 7:58
Ya Basha
1,01742133
1,01742133
hmm if you can share what kind of functions you want to do then we can help you better :)
– Hardik Satasiya
Nov 19 at 6:40
it is a normal JS function$('#hiddenField').val(JSON.stringify(valueOfExtendedField));
and after the execution of the script it will submit the formm
– Ya Basha
Nov 19 at 21:30
I managed to do that in a frontend form as I have full control over the form, I created a button and did jQuery on click event and I did the logic inside the event function and submit the form, it worked as expected.
– Ya Basha
Nov 19 at 21:31
ok but seems in backend you can not control over code so not sure you are able to processhiddenField
value, I understand you want tocreate json
and need to use it inbackend
if you share how you intend to use this details in backend then I can help you : for ex like:storing in db table etc..
– Hardik Satasiya
Nov 20 at 10:56
add a comment |
hmm if you can share what kind of functions you want to do then we can help you better :)
– Hardik Satasiya
Nov 19 at 6:40
it is a normal JS function$('#hiddenField').val(JSON.stringify(valueOfExtendedField));
and after the execution of the script it will submit the formm
– Ya Basha
Nov 19 at 21:30
I managed to do that in a frontend form as I have full control over the form, I created a button and did jQuery on click event and I did the logic inside the event function and submit the form, it worked as expected.
– Ya Basha
Nov 19 at 21:31
ok but seems in backend you can not control over code so not sure you are able to processhiddenField
value, I understand you want tocreate json
and need to use it inbackend
if you share how you intend to use this details in backend then I can help you : for ex like:storing in db table etc..
– Hardik Satasiya
Nov 20 at 10:56
hmm if you can share what kind of functions you want to do then we can help you better :)
– Hardik Satasiya
Nov 19 at 6:40
hmm if you can share what kind of functions you want to do then we can help you better :)
– Hardik Satasiya
Nov 19 at 6:40
it is a normal JS function
$('#hiddenField').val(JSON.stringify(valueOfExtendedField));
and after the execution of the script it will submit the formm– Ya Basha
Nov 19 at 21:30
it is a normal JS function
$('#hiddenField').val(JSON.stringify(valueOfExtendedField));
and after the execution of the script it will submit the formm– Ya Basha
Nov 19 at 21:30
I managed to do that in a frontend form as I have full control over the form, I created a button and did jQuery on click event and I did the logic inside the event function and submit the form, it worked as expected.
– Ya Basha
Nov 19 at 21:31
I managed to do that in a frontend form as I have full control over the form, I created a button and did jQuery on click event and I did the logic inside the event function and submit the form, it worked as expected.
– Ya Basha
Nov 19 at 21:31
ok but seems in backend you can not control over code so not sure you are able to process
hiddenField
value, I understand you want to create json
and need to use it in backend
if you share how you intend to use this details in backend then I can help you : for ex like: storing in db table etc..
– Hardik Satasiya
Nov 20 at 10:56
ok but seems in backend you can not control over code so not sure you are able to process
hiddenField
value, I understand you want to create json
and need to use it in backend
if you share how you intend to use this details in backend then I can help you : for ex like: storing in db table etc..
– Hardik Satasiya
Nov 20 at 10:56
add a comment |
1 Answer
1
active
oldest
votes
up vote
2
down vote
Add this to your Plugin.php file:
...
use App;
use Event;
class Plugin extends PluginBase
{
public function boot()
{
if (App::runningInBackend()) {
Event::listen('backend.page.beforeDisplay', function($controller, $action, $params) {
if (get_class($controller) === 'RainLabUserControllersUsers') {
$controller->addJs('/your-custom-js/file.js');
}
});
}
}
....
}
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
Add this to your Plugin.php file:
...
use App;
use Event;
class Plugin extends PluginBase
{
public function boot()
{
if (App::runningInBackend()) {
Event::listen('backend.page.beforeDisplay', function($controller, $action, $params) {
if (get_class($controller) === 'RainLabUserControllersUsers') {
$controller->addJs('/your-custom-js/file.js');
}
});
}
}
....
}
add a comment |
up vote
2
down vote
Add this to your Plugin.php file:
...
use App;
use Event;
class Plugin extends PluginBase
{
public function boot()
{
if (App::runningInBackend()) {
Event::listen('backend.page.beforeDisplay', function($controller, $action, $params) {
if (get_class($controller) === 'RainLabUserControllersUsers') {
$controller->addJs('/your-custom-js/file.js');
}
});
}
}
....
}
add a comment |
up vote
2
down vote
up vote
2
down vote
Add this to your Plugin.php file:
...
use App;
use Event;
class Plugin extends PluginBase
{
public function boot()
{
if (App::runningInBackend()) {
Event::listen('backend.page.beforeDisplay', function($controller, $action, $params) {
if (get_class($controller) === 'RainLabUserControllersUsers') {
$controller->addJs('/your-custom-js/file.js');
}
});
}
}
....
}
Add this to your Plugin.php file:
...
use App;
use Event;
class Plugin extends PluginBase
{
public function boot()
{
if (App::runningInBackend()) {
Event::listen('backend.page.beforeDisplay', function($controller, $action, $params) {
if (get_class($controller) === 'RainLabUserControllersUsers') {
$controller->addJs('/your-custom-js/file.js');
}
});
}
}
....
}
edited Nov 19 at 3:32
answered Nov 18 at 19:36
Joseph Oppegaard
398210
398210
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53358932%2fextend-user-plugin-backend-form-in-octobercms%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
hmm if you can share what kind of functions you want to do then we can help you better :)
– Hardik Satasiya
Nov 19 at 6:40
it is a normal JS function
$('#hiddenField').val(JSON.stringify(valueOfExtendedField));
and after the execution of the script it will submit the formm– Ya Basha
Nov 19 at 21:30
I managed to do that in a frontend form as I have full control over the form, I created a button and did jQuery on click event and I did the logic inside the event function and submit the form, it worked as expected.
– Ya Basha
Nov 19 at 21:31
ok but seems in backend you can not control over code so not sure you are able to process
hiddenField
value, I understand you want tocreate json
and need to use it inbackend
if you share how you intend to use this details in backend then I can help you : for ex like:storing in db table etc..
– Hardik Satasiya
Nov 20 at 10:56