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

 
Apple khởi động năm 2012 với 52% thị phần trình duyệt web di động

Apple khởi động năm 2012 với 52% thị phần trình duyệt web di động

iPhone và iPad của Apple kết thúc năm 2011 với vị trí 1 và 2 trên thị trường trình duyệt web di động.

Apple: Gã khổng lồ “tự ăn thịt chính mình”

Apple: Gã khổng lồ “tự ăn thịt chính mình”

Con đường trở thành công ty giá trị nhất hành tinh của Apple với phương châm thiết kế sản phẩm là yếu tố hàng đầu và chiến lược tự "ăn thịt" chính mình.

dien thoai di dong

Sử dụng chung di động có thể lây lan bệnh truyền nhiễm

ĐTDĐ có lượng vi khuẩn lớn gấp 10 lần so với một chiếc toilet, vì vậy không có gì ngạc nhiên khi một người đàn ông Uganda đã chết vì nhiễm vi khuẩn Ebola sau khi ăn cắp một chiếc ĐTDĐ từ phòng cách li của bệnh viện tại địa phương nơi đã bùng phát dịch bệnh do khuẩn Ebola.

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

 

Diet con trung