lovasoa / SQLpage

SQL-only webapp builder, empowering data analysts to build websites and applications quickly
https://sql.ophir.dev
MIT License
880 stars 62 forks source link

#458 - allow user to set formenctype #459

Closed djyotta closed 5 days ago

djyotta commented 1 week ago

Closes #458

djyotta commented 1 week ago

@lovasoa will do. Still testing it. I had some trouble with applying it to the textarea input directly. Seems adding it to the submit button works.

I want to make sure this works with also a file input present as they would both trigger adding the attribute to the submit button...

lovasoa commented 1 week ago

Okay, good! Switching this pr to draft mode, then. Feel free to switch it back whenever you want.

djyotta commented 1 week ago

@lovasoa after reading the following:

I decided to expose the enctype as top-level attribute as formenctype is intended for submit and image type inputs only.

Further, I would suggest we remove the formenctype being added automatically when file type input is present. Even though it's nice for newbies, there are the following short-comings:

For now I updated the docs recommending to set it explicitly for file upload rather than rely on current behaviour. I also added an example of setting different formenctype on submit buttons to labour the point.

We can decide whether to alter existing behaviour independently of this PR

lovasoa commented 6 days ago

I understand what you mean. But the whole promise of SQLPage is to make it easy to build UIs on top of databases without any other knowledge than just sql. I really think file upload should work by default, and not require even knowing what formenctype means.

djyotta commented 5 days ago

For reference - here is proposed changes that I think will make the handling of form encoding to work intuitively whilst still allowing flexability for developer to set specific encoding

https://github.com/djyotta/SQLpage/pull/1

djyotta commented 5 days ago

No problem. Thanks for SQLpage making UI easy.

Sorry I couldn't catch the vision on this one. It's hard to see the forrest through the trees sometimes.