PJZ9n / AdvancedForm

Make modern forms easy! You don't have to think about anything.
GNU General Public License v3.0
10 stars 3 forks source link

info #3

Closed ItsToxicGGAlt closed 1 year ago

ItsToxicGGAlt commented 1 year ago

so u saying its advance so whats the difference from me using formui, easyui or anything else any benefits?

PJZ9n commented 1 year ago

First of all, we apologize for not being able to explain the benefits in the README. AdvancedForm is excellent because it supports form inheritance style by default and has useful functions such as highlighting when an error occurs. And you can easily set the back button. Of course, it also fully supports validation of security measures.

This library was designed as a framework. You can easily create plugins with beautiful form without writing unnecessary code.

For example, forms and pmforms many libraries such as only support forms that take callables. AdvancedForm supports both formats. This can eliminate boilerplate code. This means that class MyForm implements pocketmine\form\Form can be used as in common PMMP implementations.

And then the error display is done simply. Now let's take a look at AdminStick. In some forms, we may want to display errors as they are entered. With AdvancedForm, you can display errors and highlights in one simple line of code (What if you don't like the style, like the color of the text? You can easily change it to whatever you like!). And the text in the middle of typing will not be deleted. setDefaults($response)

$player->sendForm($this->clean()->setDefaults($response)->addErrorByName("amount", "amount must be integer")); GiveAdminStick.php#L59 223311ab9a5917b22e1a8efa86aaa2a3

Now, let's eliminate the implementation waste by using a custom handler. Sometimes it may be necessary to provide a button to return to the previous form. But how would you implement it? In most cases you send the previous form in the handleResponse(). But with AdvancedForm this is not necessary. Let the AdvancedForm do it all.

They support named buttons, making your code easier to read and more maintainable because your code is no longer dependent on the order of the buttons.

However, please note that this is a work in progress. Suggest what you think is good and let's complete this library together!