lambdanative icon indicating copy to clipboard operation
lambdanative copied to clipboard

uiform textentry default issue

Open karliwalti opened this issue 4 years ago • 4 comments

In the uiform module the textentry allows to set a default value for the textfield which is set when no value is avalable: https://github.com/part-cw/lambdanative/blob/f7a8eeadad39a42b6ae0abd6f8728f0c5cc36674/modules/uiform/uiform.scm#L477

This causes an issue when the value is read ,i.e. with (uiget

In my opinion this can be fixed with setting id to default in this case (default not #f), but before making this patch I wanted to ask whether this would mess up someones forms?

karliwalti avatar Mar 09 '21 09:03 karliwalti

@peterlew is the one using this module right now through an LNHealth app, so he should comment on this.

ddunsmuir avatar Mar 09 '21 18:03 ddunsmuir

Are you describing how using 'default shows the string in the textfield but doesn't actually store it as a value? I've encountered that too. There are some cases where I would want the id to be set to default, but I think there are a lot of others where we don't. Sometimes default is used as a prompt, but we still want to be able to check if any value has been entered.

What about having a new option, like "defaultval", that both displays and sets the default value?

peterlew avatar Mar 09 '21 18:03 peterlew

Yes that is what I meant and I suspected that both cases are desirable based on situation. At the moment it is rather used as example value than default...

May I suggest to rather create an additional flag that decides whether to use the default as value or not if there is no value set.

Would you like me to make a code suggestion with pull request?

karliwalti avatar Mar 18 '21 06:03 karliwalti

May I suggest to rather create an additional flag that decides whether to use the default as value or not if there is no value set.

Yes, this seems like a good approach to me.

Would you like me to make a code suggestion with pull request?

That sounds good - I'd be happy to review and test it. Thanks!

peterlew avatar Mar 18 '21 16:03 peterlew