ujjwalguptaofficial / mahal

Simple, modern web application framework for UI development.
https://mahaljs.com/
45 stars 2 forks source link

model directive not working for checkbox, radio buttons, and select #11

Closed mrez0 closed 1 year ago

mrez0 commented 1 year ago

Summary

"model" directive to be improved to include two-way data binding with different HTML elements such as checkbox, select, textarea.

ujjwalguptaofficial commented 1 year ago

Thanks for adding the issue @mrez0, will work on it.

ujjwalguptaofficial commented 1 year ago

fixed in v - 1.8.1 @mrez0 , please check and let me know.

ujjwalguptaofficial commented 1 year ago

have also updated doc - https://mahaljs.com/docs/basic/model/#checkbox

mrez0 commented 1 year ago

Thanks @ujjwalguptaofficial for the updates.

Works great for checkbox, radio buttons, and textarea.

For "select" the binding is working from HTML to JS, but not the other way from JS to HTMl. For example, when "select" is bound to a string in the component class, it does not show the correct option in the select element. Also, when changing the select value in JS code, it does not reflect that value to the select element in HTML.

Another issue (I don't know if I need to open another issue for that or not) is that the command "npx @mahaljs/creator init" shall install the last updated version of the framework. Currently, it is installing the framework @version 1.5.0

ujjwalguptaofficial commented 1 year ago

oh my bad - forgot to handle the select, handled in v - 1.8.2. Please check and let me know.

I have added the test for each input type with different cases, please check here - https://github.com/ujjwalguptaofficial/mahal/blob/master/tests/typescript/test/model.test.ts and let me know if i am missing something.

also regarding the latest version in mahal-creator - this has been done deliberately to not to update to latest version as things might not be stable in each version - i am keeping the package stable in the creator.

mrez0 commented 1 year ago

All works perfectly. Thanks