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

 
Sử dụng Search Module trong Drupal như thế nào?

Sử dụng Search Module trong Drupal như thế nào?

The search module is a perfect example of something that is initially confusing to set up, but easy once you know how do it correctly.

Bí quyết trốn thoát khỏi Facebook Timeline

Bí quyết trốn thoát khỏi Facebook Timeline

Nếu thực sự bức xúc với giao diện mới, bạn hãy cài trình duyệt IE7 xem sao.

Cài đặt nhanh drush (and pear) trên osx 10.8

Cài đặt nhanh drush (and pear) trên osx 10.8

I was reconfiguring my localhost, and needed to install mighty drush on OSX 10.8 Mountain Lion.

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

 

Diet con trung