How to add time range picker to adminhtml form in Magento 2?Magento 2 Show timepicker using UiComponent not DatepickerModel _beforeSave observer can't save timeMagento 2 Pattern Library — Date & Time SelectorsHow to include custom javascript to admihtml edit form in Magento 2?Magento 2 : How to add additional fields to newsletterMagento 2.1 - Add category selector field in backend custom model formMagento2 : how to create admin page with configuration fieldsMagento 2: How to add a Color Picker in Grid?Date Time picker and time zone woesMagento 2.1.11 - adminhtml - Saving model to database with boolean field does not match valueCan't get a time field value in admin form

What term is being referred to with "reflected-sound-of-underground-spirits"?

bldc motor, esc and battery draw, nominal vs peak

How can I practically buy stocks?

How to not starve gigantic beasts

Is the claim "Employers won't employ people with no 'social media presence'" realistic?

Why did C use the -> operator instead of reusing the . operator?

How to pronounce 'c++' in Spanish

Rivers without rain

On The Origin of Dissonant Chords

Elements other than carbon that can form many different compounds by bonding to themselves?

Alignment of various blocks in tikz

Do I have an "anti-research" personality?

How to display Aura JS Errors Lightning Out

Phrase for the opposite of "foolproof"

Does a large simulator bay have standard public address announcements?

Re-entry to Germany after vacation using blue card

If a planet has 3 moons, is it possible to have triple Full/New Moons at once?

Function pointer with named arguments?

555 timer FM transmitter

What is causing the white spot to appear in some of my pictures

Is there a way to generate a list of distinct numbers such that no two subsets ever have an equal sum?

Why do games have consumables?

Dynamic SOQL query relationship with field visibility for Users

A strange hotel



How to add time range picker to adminhtml form in Magento 2?


Magento 2 Show timepicker using UiComponent not DatepickerModel _beforeSave observer can't save timeMagento 2 Pattern Library — Date & Time SelectorsHow to include custom javascript to admihtml edit form in Magento 2?Magento 2 : How to add additional fields to newsletterMagento 2.1 - Add category selector field in backend custom model formMagento2 : how to create admin page with configuration fieldsMagento 2: How to add a Color Picker in Grid?Date Time picker and time zone woesMagento 2.1.11 - adminhtml - Saving model to database with boolean field does not match valueCan't get a time field value in admin form






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








10















In Magento 2's devdocs pages there is an example of
time range picker.
enter image description here
But ,i can not find any examples of how to add it in my backend form for creating/editing of custom model.
Have anyone any idea of how to do this?



Also ,i have a question on how to save it in mysql database. Do this picker needs 2 fields ("from" and "to") to store entered time?










share|improve this question
















bumped to the homepage by Community 6 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • Here is a link to how to add uiComponents devdocs.magento.com/guides/v2.3/ui_comp_guide/howto/… It is along same lines, create the attributes to save in db, create the xml to display.

    – djfordz
    Dec 17 '18 at 12:57











  • @jurgen did you ever find a solution for this one?

    – magefms
    Apr 12 at 3:17











  • No, I no longer work with Magento2

    – jurgen
    Apr 18 at 19:13

















10















In Magento 2's devdocs pages there is an example of
time range picker.
enter image description here
But ,i can not find any examples of how to add it in my backend form for creating/editing of custom model.
Have anyone any idea of how to do this?



Also ,i have a question on how to save it in mysql database. Do this picker needs 2 fields ("from" and "to") to store entered time?










share|improve this question
















bumped to the homepage by Community 6 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • Here is a link to how to add uiComponents devdocs.magento.com/guides/v2.3/ui_comp_guide/howto/… It is along same lines, create the attributes to save in db, create the xml to display.

    – djfordz
    Dec 17 '18 at 12:57











  • @jurgen did you ever find a solution for this one?

    – magefms
    Apr 12 at 3:17











  • No, I no longer work with Magento2

    – jurgen
    Apr 18 at 19:13













10












10








10


3






In Magento 2's devdocs pages there is an example of
time range picker.
enter image description here
But ,i can not find any examples of how to add it in my backend form for creating/editing of custom model.
Have anyone any idea of how to do this?



Also ,i have a question on how to save it in mysql database. Do this picker needs 2 fields ("from" and "to") to store entered time?










share|improve this question
















In Magento 2's devdocs pages there is an example of
time range picker.
enter image description here
But ,i can not find any examples of how to add it in my backend form for creating/editing of custom model.
Have anyone any idea of how to do this?



Also ,i have a question on how to save it in mysql database. Do this picker needs 2 fields ("from" and "to") to store entered time?







magento2 adminhtml






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited May 5 '16 at 9:32









Amit Bera

60.3k1678178




60.3k1678178










asked May 5 '16 at 7:39









jurgenjurgen

180112




180112





bumped to the homepage by Community 6 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 6 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.














  • Here is a link to how to add uiComponents devdocs.magento.com/guides/v2.3/ui_comp_guide/howto/… It is along same lines, create the attributes to save in db, create the xml to display.

    – djfordz
    Dec 17 '18 at 12:57











  • @jurgen did you ever find a solution for this one?

    – magefms
    Apr 12 at 3:17











  • No, I no longer work with Magento2

    – jurgen
    Apr 18 at 19:13

















  • Here is a link to how to add uiComponents devdocs.magento.com/guides/v2.3/ui_comp_guide/howto/… It is along same lines, create the attributes to save in db, create the xml to display.

    – djfordz
    Dec 17 '18 at 12:57











  • @jurgen did you ever find a solution for this one?

    – magefms
    Apr 12 at 3:17











  • No, I no longer work with Magento2

    – jurgen
    Apr 18 at 19:13
















Here is a link to how to add uiComponents devdocs.magento.com/guides/v2.3/ui_comp_guide/howto/… It is along same lines, create the attributes to save in db, create the xml to display.

– djfordz
Dec 17 '18 at 12:57





Here is a link to how to add uiComponents devdocs.magento.com/guides/v2.3/ui_comp_guide/howto/… It is along same lines, create the attributes to save in db, create the xml to display.

– djfordz
Dec 17 '18 at 12:57













@jurgen did you ever find a solution for this one?

– magefms
Apr 12 at 3:17





@jurgen did you ever find a solution for this one?

– magefms
Apr 12 at 3:17













No, I no longer work with Magento2

– jurgen
Apr 18 at 19:13





No, I no longer work with Magento2

– jurgen
Apr 18 at 19:13










1 Answer
1






active

oldest

votes


















0














Try this,



Under appcodeNamespaceModuleBlockAdminhtmlCustomEditForm.php



$fieldset->addField(
'from',
'time',
[
'name' => 'from',
'label' => __('From'),
'title' => __('From'),
'required' => true,
'note' => __('From Timer')
]
);

$fieldset->addField(
'to',
'time',
[
'name' => 'to',
'label' => __('To'),
'title' => __('To'),
'required' => true,
'note' => __('To Timer')
]
);


Create the field in database to save the to and from values.



In controller file,



public function saveData()

$data = $this->getRequest()->getPostValue();
$model = $this->_objectManager->create('NamespaceModuleModelCustom');
$model->setData($data);
$model->save();






share|improve this answer

























  • I've tried this earlier. This code adds two time fields positioned vertically. If I need 7 time range pickers (for each day of week) it looks very cumbersome. I wanted to place it at least in one line but much desirable to have it exact as on picture above. My opinion is that this time range picker exists only in Magento 2 design patterns and does not have implementation yet. For now I made it using single text field and Bootstrap Date Range Picker, customized it to show only time range. Result I save in DB in text format ("10:00-15:00" for example) which suits for my tasks.

    – jurgen
    Jun 8 '16 at 6:33












Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f114043%2fhow-to-add-time-range-picker-to-adminhtml-form-in-magento-2%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














Try this,



Under appcodeNamespaceModuleBlockAdminhtmlCustomEditForm.php



$fieldset->addField(
'from',
'time',
[
'name' => 'from',
'label' => __('From'),
'title' => __('From'),
'required' => true,
'note' => __('From Timer')
]
);

$fieldset->addField(
'to',
'time',
[
'name' => 'to',
'label' => __('To'),
'title' => __('To'),
'required' => true,
'note' => __('To Timer')
]
);


Create the field in database to save the to and from values.



In controller file,



public function saveData()

$data = $this->getRequest()->getPostValue();
$model = $this->_objectManager->create('NamespaceModuleModelCustom');
$model->setData($data);
$model->save();






share|improve this answer

























  • I've tried this earlier. This code adds two time fields positioned vertically. If I need 7 time range pickers (for each day of week) it looks very cumbersome. I wanted to place it at least in one line but much desirable to have it exact as on picture above. My opinion is that this time range picker exists only in Magento 2 design patterns and does not have implementation yet. For now I made it using single text field and Bootstrap Date Range Picker, customized it to show only time range. Result I save in DB in text format ("10:00-15:00" for example) which suits for my tasks.

    – jurgen
    Jun 8 '16 at 6:33
















0














Try this,



Under appcodeNamespaceModuleBlockAdminhtmlCustomEditForm.php



$fieldset->addField(
'from',
'time',
[
'name' => 'from',
'label' => __('From'),
'title' => __('From'),
'required' => true,
'note' => __('From Timer')
]
);

$fieldset->addField(
'to',
'time',
[
'name' => 'to',
'label' => __('To'),
'title' => __('To'),
'required' => true,
'note' => __('To Timer')
]
);


Create the field in database to save the to and from values.



In controller file,



public function saveData()

$data = $this->getRequest()->getPostValue();
$model = $this->_objectManager->create('NamespaceModuleModelCustom');
$model->setData($data);
$model->save();






share|improve this answer

























  • I've tried this earlier. This code adds two time fields positioned vertically. If I need 7 time range pickers (for each day of week) it looks very cumbersome. I wanted to place it at least in one line but much desirable to have it exact as on picture above. My opinion is that this time range picker exists only in Magento 2 design patterns and does not have implementation yet. For now I made it using single text field and Bootstrap Date Range Picker, customized it to show only time range. Result I save in DB in text format ("10:00-15:00" for example) which suits for my tasks.

    – jurgen
    Jun 8 '16 at 6:33














0












0








0







Try this,



Under appcodeNamespaceModuleBlockAdminhtmlCustomEditForm.php



$fieldset->addField(
'from',
'time',
[
'name' => 'from',
'label' => __('From'),
'title' => __('From'),
'required' => true,
'note' => __('From Timer')
]
);

$fieldset->addField(
'to',
'time',
[
'name' => 'to',
'label' => __('To'),
'title' => __('To'),
'required' => true,
'note' => __('To Timer')
]
);


Create the field in database to save the to and from values.



In controller file,



public function saveData()

$data = $this->getRequest()->getPostValue();
$model = $this->_objectManager->create('NamespaceModuleModelCustom');
$model->setData($data);
$model->save();






share|improve this answer















Try this,



Under appcodeNamespaceModuleBlockAdminhtmlCustomEditForm.php



$fieldset->addField(
'from',
'time',
[
'name' => 'from',
'label' => __('From'),
'title' => __('From'),
'required' => true,
'note' => __('From Timer')
]
);

$fieldset->addField(
'to',
'time',
[
'name' => 'to',
'label' => __('To'),
'title' => __('To'),
'required' => true,
'note' => __('To Timer')
]
);


Create the field in database to save the to and from values.



In controller file,



public function saveData()

$data = $this->getRequest()->getPostValue();
$model = $this->_objectManager->create('NamespaceModuleModelCustom');
$model->setData($data);
$model->save();







share|improve this answer














share|improve this answer



share|improve this answer








edited Jun 6 '16 at 11:44

























answered Jun 6 '16 at 11:21









saravanavelusaravanavelu

3,05562245




3,05562245












  • I've tried this earlier. This code adds two time fields positioned vertically. If I need 7 time range pickers (for each day of week) it looks very cumbersome. I wanted to place it at least in one line but much desirable to have it exact as on picture above. My opinion is that this time range picker exists only in Magento 2 design patterns and does not have implementation yet. For now I made it using single text field and Bootstrap Date Range Picker, customized it to show only time range. Result I save in DB in text format ("10:00-15:00" for example) which suits for my tasks.

    – jurgen
    Jun 8 '16 at 6:33


















  • I've tried this earlier. This code adds two time fields positioned vertically. If I need 7 time range pickers (for each day of week) it looks very cumbersome. I wanted to place it at least in one line but much desirable to have it exact as on picture above. My opinion is that this time range picker exists only in Magento 2 design patterns and does not have implementation yet. For now I made it using single text field and Bootstrap Date Range Picker, customized it to show only time range. Result I save in DB in text format ("10:00-15:00" for example) which suits for my tasks.

    – jurgen
    Jun 8 '16 at 6:33

















I've tried this earlier. This code adds two time fields positioned vertically. If I need 7 time range pickers (for each day of week) it looks very cumbersome. I wanted to place it at least in one line but much desirable to have it exact as on picture above. My opinion is that this time range picker exists only in Magento 2 design patterns and does not have implementation yet. For now I made it using single text field and Bootstrap Date Range Picker, customized it to show only time range. Result I save in DB in text format ("10:00-15:00" for example) which suits for my tasks.

– jurgen
Jun 8 '16 at 6:33






I've tried this earlier. This code adds two time fields positioned vertically. If I need 7 time range pickers (for each day of week) it looks very cumbersome. I wanted to place it at least in one line but much desirable to have it exact as on picture above. My opinion is that this time range picker exists only in Magento 2 design patterns and does not have implementation yet. For now I made it using single text field and Bootstrap Date Range Picker, customized it to show only time range. Result I save in DB in text format ("10:00-15:00" for example) which suits for my tasks.

– jurgen
Jun 8 '16 at 6:33


















draft saved

draft discarded
















































Thanks for contributing an answer to Magento Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f114043%2fhow-to-add-time-range-picker-to-adminhtml-form-in-magento-2%23new-answer', 'question_page');

);

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







Popular posts from this blog

Can not update quote_id field of “quote_item” table magento 2Magento 2.1 - We can't remove the item. (Shopping Cart doesnt allow us to remove items before becomes empty)Add value for custom quote item attribute using REST apiREST API endpoint v1/carts/cartId/items always returns error messageCorrect way to save entries to databaseHow to remove all associated quote objects of a customer completelyMagento 2 - Save value from custom input field to quote_itemGet quote_item data using quote id and product id filter in Magento 2How to set additional data to quote_item table from controller in Magento 2?What is the purpose of additional_data column in quote_item table in magento2Set Custom Price to Quote item magento2 from controller

Magento 2 disable Secret Key on URL's from terminal The Next CEO of Stack OverflowMagento 2 Shortcut/GUI tool to perform commandline tasks for windowsIn menu add configuration linkMagento oAuth : Generating access token and access secretMagento 2 security key issue in Third-Party API redirect URIPublic actions in admin controllersHow to Disable Cache in Custom WidgetURL Key not changing in Magento 2Product URL Key gets deleted when importing custom options - Magento 2Problem with reindex terminalMagento 2 - bin/magento Commands not working in Cpanel Terminal

Aasi (pallopeli) Navigointivalikko