Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add remove field functionality #8

Open
gabipetrovay opened this issue Sep 9, 2013 · 7 comments
Open

Add remove field functionality #8

gabipetrovay opened this issue Sep 9, 2013 · 7 comments
Assignees

Comments

@gabipetrovay
Copy link
Contributor

A form should be aware that fields can exist or not, and when they exist they have a value.

For the non-existing fields that the user wants to render as inputs, the form should disable the DOM inputs. The user MUST click on an input to start editing it. This makes the user aware that the field now exists (even if it has an empty value)

The opposite should also be true. When the user wants to remove a field (NOT by setting an empty value), he should have a DOM handle to triggers an $unset (instead of $set) and disable the input field in the same time. In this state the user can go back to editing mode it he clicks again on the DOM input.

The remove handler can be pointed by a selector specified in the field selectors property.

@ghost ghost assigned ottiker Sep 9, 2013
@gabipetrovay gabipetrovay assigned danandrei and unassigned ottiker Jun 14, 2014
@gabipetrovay
Copy link
Contributor Author

For disabling inputs (only inputs need to be disabled) I would use the disabled attribute.

The user scenario is the following:

  • one want to render in a form an object that is missing a key
  • the form, detects the missing key for that field in the object item that needs to be rendered and adds the disabled attribute to the input/select AND a click handler that, if the disabled input is clicked on, the disable attribute is removed.
  • the user can now write a (new) value in the input
  • if the user wants to delete that field from the object, when he hovers over the input (with or without value, but not-disabled) an X is shown towards the end of the input. Clicking on it, it will clear the input content and set it to disabled.
  • when the form is saved, the form must take into consideration disabled inputs and send $unset operators to the server instead of $set

@danandrei please ask @lucaboieru to help with the client CSS/JS for the X hover and for the click to enable handler

@danandrei
Copy link
Contributor

Added a beta version of this in 836d26f this was installed in cc-tool in https://bitbucket.org/jillix/cctool/commits/e0613c4bc9d2a583b32a792658392c4f16088cf9, please take a look and tell me what you think

@danandrei danandrei assigned gabipetrovay and unassigned danandrei Jun 21, 2014
@gabipetrovay
Copy link
Contributor Author

Finally a great feature!

@gabipetrovay
Copy link
Contributor Author

I see the first problem: When a form is loaded for a new (when creating) item, the inputs that were disabled for the last item, are still disabled in the create item form. For empty forms (create new item) all the disabled inputs should be reset to non disabled.

@danandrei
Copy link
Contributor

fixed it in d3dd380

@danandrei
Copy link
Contributor

And also I noticed that using this feature a user can delete require inputs, for example the username of a user can be deleted, which is not a very good thing.

@danandrei danandrei assigned gabipetrovay and unassigned danandrei Jun 24, 2014
@gabipetrovay
Copy link
Contributor Author

Added issu #22 in modm

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

4 participants