Angular forms, một dạng khác của Form API trong Drupal 7

Angular forms, một dạng khác của Form API trong Drupal 7

  • Form API is great, but Form API is hard when you try to do fancier stuff - like wizards and other things that clients often want.
  • Angular forms are great, but Angular forms are hard too - you need to write your own custom endpoints and server side validation.

But now that RESTful integrates with Entity Validator, I would change the equation and simply say something rarely heard in the Drupal community: Forms are Fun!

This form is not Form API, it's angular!

Go ahead, try it yourself on simplyTest.me

The example module shows how all the HTML, CSS, and JS are bundled together in an Angular App, and Drupal simply ng-includes it.

The tricky part is the server side validation, which is now handled by Entity Validator module. And of course the endpoint itself is handled by RESTful which does a lot of the heavy lifting by taking care of authentication, permissions, CSRF tokens, exposing the RESTful resource etc.

Developers would appreciate the very little code needed to declare the validation and the RESTful resource.

As a benefit, since RESTful spits out structured error messages, displaying error messages inline is really simple.

Detailed errors are part of the JSON response

Angular forms, một dạng khác của Form API trong Drupal 7

Inline errors, provide a better UX

In Gizra we already have projects where we don't use any node form to create or edit content. Everything is implemented in a slick Angular based UI - one that users enjoy using.

Headless Drupal isn't in the future. It's here, and you can start using it with test-covered and OOP modules like RESTful and Zariz.

Bạn thấy bài viết này như thế nào?: 
No votes yet
Ảnh của Tommy Tran

Tommy owner Express Magazine

Drupal Developer having 9+ year experience, implementation and having strong knowledge of technical specifications, workflow development. Ability to perform effectively and efficiently in team and individually. Always enthusiastic and interseted to study new technologies

  • Skype ID: tthanhthuy

Tìm kiếm bất động sản

 

Advertisement

 

jobsora

Dich vu khu trung tphcm

Dich vu diet chuot tphcm

Dich vu diet con trung

Quảng Cáo Bài Viết

 
Hướng dẫn chính cho Drupal 8: Episode 2 - Mobile Improvements

Hướng dẫn chính cho Drupal 8: Episode 2 - Mobile Improvements

Successive posts will gradually get more technical, so feel free to skip to later parts (once they're published) if you're more on the geeky side.

Bí quyết 1 - Multilingual Site trong Drupal 7

Bí quyết 1 - Multilingual Site trong Drupal 7

As we discussed in our first introductory blog post, Recipes for Building a Multilingual Site, not all Drupal installations are the same and nearly every site built with Drupal is different in one way or another

10 món quà công nghệ xa xỉ trong dịp Noel

10 món quà công nghệ xa xỉ trong dịp Noel

Nếu bạn là người có điều kiện và muốn mua một món quà công nghệ phong cách và ấn tượng cho bạn bè, người thân hay cấp trên, những sản phẩm sau đây sẽ làm bạn hài lòng.

Công ty diệt chuột T&C

 

Diet con trung