Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Port the ajax add more button example to drupal 8.
The above is the image which describes about the ajax example which was in drupal 7
Proposed resolution
Port the ajax add more button example to d8 .
Testing Instructions
- Enable example and Form API Example module .
- After enabling you will find a sub menu named Ajax add more example
- Enter the value in textbox and click on add one more textbox is added to the form
- And on click of remove button it removes the recently added textbox.
- On click of submit it displays all values entered in textbox.
Comment | File | Size | Author |
---|---|---|---|
#17 | add_more-2720361-17.patch | 5.95 KB | Shreya Shetty |
| |||
#12 | add_more-2720361-12.patch | 4.29 KB | Shreya Shetty |
| |||
#10 | Add more button with graceful degradation.png | 45.78 KB | Shreya Shetty |
#2 | add_more-2720361-2.patch | 4.3 KB | Shreya Shetty |
Comments
Comment #2
Shreya Shetty CreditAttribution: Shreya Shetty commentedHi I have created a patch for the feature requested . But for now i have included this under form examples menu . We can create an independent menu of ajax examples wherein we can include more examples on ajax.
Comment #4
Shreya Shetty CreditAttribution: Shreya Shetty commentedComment #5
navneet0693 CreditAttribution: navneet0693 as a volunteer and at QED42 commented@Shreya: We have something going on here: #2102639: Port ajax_example module to Drupal 8 Does this issue needs a summary update ? For porting refer: https://www.drupal.org/node/1880976 Please, correct me if I am wrong in understanding this issue :P.
Comment #6
navneet0693 CreditAttribution: navneet0693 as a volunteer and at QED42 commentedComment #7
Shreya Shetty CreditAttribution: Shreya Shetty commentedYes .. in drupal 7 we had many examples on ajax..The issue which u mentioned is of other ajax example in d7.And this ajax example is different from the issue u have mentioned.
Comment #8
navneet0693 CreditAttribution: navneet0693 as a volunteer and at QED42 commented@Shreya: Can we update summary for more explanation ?
Comment #9
Shreya Shetty CreditAttribution: Shreya Shetty commentedSure...we can.
Comment #10
Shreya Shetty CreditAttribution: Shreya Shetty commentedComment #11
Shreya Shetty CreditAttribution: Shreya Shetty commentedComment #12
Shreya Shetty CreditAttribution: Shreya Shetty commentedComment #13
Riya Roy CreditAttribution: Riya Roy commentedI have tested the patch it works fine . Now its up to the maintainers to include this ajax example in examples module
Comment #14
Torenware CreditAttribution: Torenware as a volunteer commentedThis should be different from the regular AJAX example.
You need a new line at end of file.
Again, no NL at EOL.
Again, you need a NL alone in the last line.
In addition, if you notice, the controller lists the examples for the Form API Example Module. You need to add yours to this.
It might even be better just to combine these two AJAX examples into a single form, which is easy enough to do. I'm curious what other folks might think about this.
Comment #15
Torenware CreditAttribution: Torenware as a volunteer commentedAlso: a lot of issues with indentation and comment structure. Here, you may want to install phpcs, a tool we very often use to check files for indentation and other style errors. You can find some instructions here: #2176147: [meta] Coding standards review for D8 Examples.
It will take you a bit to install the tool, but I strongly recommend it. It will make it very easy for you to write "core ready" code, since the tool finds all kinds of things you might not know about, or even see.
Once you've run the tool and fixed the problems you find, I'll give the issue another look.
Thanks for working on this; we're not too far from being done here.
Comment #16
Shreya Shetty CreditAttribution: Shreya Shetty commentedComment #17
Shreya Shetty CreditAttribution: Shreya Shetty as a volunteer and at Trigyn Technologies Ltd commentedThanks a ton @Rob for the guidance . I have done as per suggestion given by you . Since we have only two examples based on ajax for now let it be under form example . Later on if we have more ajax examples we can think of combining all those to a single form . I would like to hear from the community what they think on it . Please review the patch .
Comment #18
Riya Roy CreditAttribution: Riya Roy commentedYes everything looks fine . Good to go .
Comment #19
Torenware CreditAttribution: Torenware as a volunteer commentedOne trivial error: this line has an extra space of indent (9 instead of 8). I'll fix this before I check this in.
Comment #21
Torenware CreditAttribution: Torenware as a volunteer commentedThanks for your work on this. The extra space has been removed, and I've checked this in.
Comment #22
Shreya Shetty CreditAttribution: Shreya Shetty as a volunteer and at Trigyn Technologies Ltd commentedThanks a lot @Rob for fixing and committing this . Will look forward to give more patches.