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 Tran

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

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

 
Search engine optimization (SEO)

Thêm Meta Tags vào 1 node của Drupal Content

Search engine optimization (SEO) is often at the top of the to-do list when planning a site.

Apple phát hành bản cập nhật Java

Apple phát hành bản cập nhật Java

Java cho Mac OS X 10.7 Update 1, phát hành hôm thứ 3 ngày 8/11, cập nhật phần mềm cho phiên bản 1.6.0_29, và cung cấp một số cải thiện về độ tin cậy, bảo mật, khả năng tương thích cho người dùng Mac OS X Lion.

Open Public

Giới thiệu Drupal distributions: Open Public phát triển bằng Drupal

Public Open is a government-oriented and political sites distribution. Its purpose is that sites are secure, scalable and transparent. Many government sites are built on Drupal because of its robustness and scalability, from the White House or the Senate of the State of New York to other international sites.