🚀 Creating an AJAX Form into our Drupal 8 custom module programmatically

  Рет қаралды 14,214

Drupal Up - Drupal 8 Video Tutorials

Drupal Up - Drupal 8 Video Tutorials

Күн бұрын

Пікірлер
@naderat
@naderat 2 жыл бұрын
Thank you so much. Your videos are very helpful :-)
@andresanxoperezsanchez6665
@andresanxoperezsanchez6665 5 жыл бұрын
Thank you! this video is very useful
@oleksandrsyvyi6242
@oleksandrsyvyi6242 6 жыл бұрын
Hi Nikolay, what is the reason to use $this->t(Calculate) instead t(Calculate)? And what is reason to use &$form instead $form?
@Drupal-up
@Drupal-up 6 жыл бұрын
Hi Александр, great question again! We are supposed to use $this->t() in order to use the services that are injected for us just by extending the FormBase class (api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Form%21FormBase.php/class/FormBase/8.2.x). This way the whole quality of the code is better and testable. In a simple example - there is no difference, but in the general case, it is a good practice to either extend a base class in order to have some services and use them or inject the services that you need and use them. Just using t() is possible because of Drupal 7 legacy, but is a bad practice for Drupal 8 projects. Passing by reference is kind of a requirement for almost all Drupal form functions, except buildForm. That's I think because we have the hook_form_alter hook in Drupal and if you want to alter the form at some state by another module of yours - it should be passed by reference because in hook_form_alter we are of course not returning anything. here is the documentation of hook_form_alter: api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Form%21form.api.php/function/hook_form_alter/8.5.x here is your question, answered by someone on drupal.org: www.drupal.org/forum/support/module-development-and-code-questions/2012-12-25/why-we-pass-arguments-with-reference Cheers and have a nice day! Nikolay
@oleksandrsyvyi6242
@oleksandrsyvyi6242 6 жыл бұрын
Drupal Up - Drupal 8 Video Tutorials thanks for the fact that my questions are interesting for you and you give answers for it. Can you please discover the in you video: services, dependency injections and event subscribers ??
@Soumya21st
@Soumya21st 6 жыл бұрын
Great tutorials. Keep it up!!! I have two questions regarding this 1)The message is shown in result_message or my_top_message. Also I want to show the message beside the second text box and not on top 2)How can I show the result for mouseout/mouseleave option and not by clicking a button?
@Drupal-up
@Drupal-up 6 жыл бұрын
Hi Soumya Banerjee, If you check the code here github.com/drupal-up/drupalup_simple_form/blob/master/src/Form/SimpleAjaxForm.php You will see that setMessage() method with the help of HtmlCommand is setting the result in an element with class "result_message" - it could be basically any element on the page it is not restricted to the elements that we create. For your second question, you can use something like this and then implement the callback function as shown in this video $form['textfieldname'] = array( '#type' => 'textfield', '#title' => t('Your field'), '#ajax' => [ 'callback' => '::fetchApiData', 'event' => 'change', 'prevent' => 'click', ], ); have a look at the docu here www.drupal.org/docs/8/api/javascript-api/ajax-forms In the future I am planning to create a video also about other similar problems. Cheers!
@Soumya21st
@Soumya21st 6 жыл бұрын
Superb!!! Thanks a ton
@webdevelopment5076
@webdevelopment5076 5 жыл бұрын
i need ajax dropdown pls share
@hamzaliaqat952
@hamzaliaqat952 5 жыл бұрын
make a video to insert images into database with custom form
@shivalik_chopra
@shivalik_chopra 5 жыл бұрын
I want to insert and edit values of form. Saving values in db
@monishanarayan3537
@monishanarayan3537 4 жыл бұрын
It shows me page not found error while redirecting through the path name
@epi_sto_letes
@epi_sto_letes 6 жыл бұрын
supporting AJAX in D8 seems to have gotten more complicated.
@cooliofv
@cooliofv 6 жыл бұрын
А по русски нельзя? Американе, блин.
@Drupal-up
@Drupal-up 6 жыл бұрын
Hi Алексей, yes, sorry but I don't speak Russian ... the end code of this video you still may find here though -> github.com/drupal-up/drupalup_simple_form/blob/master/src/Form/SimpleAjaxForm.php Also if you ask any question in Russain - I will try to answer it. Cheers and have a nice day!
@kirillkirillovich7316
@kirillkirillovich7316 4 жыл бұрын
@@Drupal-up можливо українською мовою буде ?
Drupal 8 passing JS variables from controller
12:47
Drupal Up - Drupal 8 Video Tutorials
Рет қаралды 7 М.
Drupal 8 Day: Demystifying AJAX Callback Commands in Drupal 8
47:49
Quando eu quero Sushi (sem desperdiçar) 🍣
00:26
Los Wagners
Рет қаралды 15 МЛН
When you have a very capricious child 😂😘👍
00:16
Like Asiya
Рет қаралды 18 МЛН
We Attempted The Impossible 😱
00:54
Topper Guild
Рет қаралды 56 МЛН
Гениальное изобретение из обычного стаканчика!
00:31
Лютая физика | Олимпиадная физика
Рет қаралды 4,8 МЛН
Generating a module and a custom form with Drupal Console
10:54
Drupal Up - Drupal 8 Video Tutorials
Рет қаралды 4,3 М.
Custom module with programatically created block
13:44
Drupal Up - Drupal 8 Video Tutorials
Рет қаралды 10 М.
🚀 Developing a Drupal 8 module with a controller and custom template
15:18
Drupal Up - Drupal 8 Video Tutorials
Рет қаралды 45 М.
MAKERS & BUILDERS - The Form API Workflow
46:11
Drupal Association
Рет қаралды 927
Webinar: Drupal 8 Debugging Techniques
50:23
WebWash
Рет қаралды 13 М.
hook_preprocess and hook_preprocess_hook functions in Drupal 8
8:43
Drupal Up - Drupal 8 Video Tutorials
Рет қаралды 10 М.
Exposing Your API in Drupal 8
9:59
Drupalize.Me
Рет қаралды 24 М.
Mastering Dependency Injection in Drupal | Part 1: The Essentials
7:38
Quando eu quero Sushi (sem desperdiçar) 🍣
00:26
Los Wagners
Рет қаралды 15 МЛН