formbuilder icon indicating copy to clipboard operation
formbuilder copied to clipboard

Remove default label values on keypress

Open DirtyF opened this issue 9 years ago • 11 comments

Given that I am editing a (short text | long text | checkbox | choicelist ) label in the form builder When I click on the label and the field receives focus Then the user can type right away without having to replace the default value (Question| option) (1|2|3)

DirtyF avatar Jun 01 '16 20:06 DirtyF

Good catch!

almet avatar Jun 01 '16 23:06 almet

I tried this one without any success. I didn't find a way to assign onFocus event to the textWidget. I've also tried to use jsonschema's placeholder but it's not available on the installed version.

rlecellier avatar Sep 17 '16 10:09 rlecellier

Please go ahead if you want to upgrade the installed version of RJSF!

almet avatar Sep 19 '16 12:09 almet

i may try. however the last version of jsonschema required the last version of react.

rlecellier avatar Sep 19 '16 13:09 rlecellier

I just ran into this and found this issue already reported.

@almet I think it's better to keep the default value (Question| option) (1|2|3) as a placeholder instead of value for the form field. What do you think?

I'll push the fix once you confirm.

sahildua2305 avatar Oct 18 '16 20:10 sahildua2305

That sounds like the best way to act, I concur. Let's go!

almet avatar Oct 19 '16 11:10 almet

Cool! I'll push the fix later today.

sahildua2305 avatar Oct 19 '16 11:10 sahildua2305

@almet I tried adding something like following after this line here

state.uiSchema[_slug]["ui:placeholder"] = name;

Doesn't seem to work. Can you please check this?

sahildua2305 avatar Oct 19 '16 22:10 sahildua2305

Hum, I tried as well without more success. Actually, I wonder if what we want here is a placeholder, since the default value should stay the default one, whereas a placeholder would force the user to enter a value.

almet avatar Oct 19 '16 23:10 almet

Hmm.. I have another idea -

We can add onclick="this.focus();this.select()" to the input field. This will make sure once user clicks in the input field, all the default text is selected automatically hence making it easy for the user to remove it and add something custom. Makes sense?

sahildua2305 avatar Oct 19 '16 23:10 sahildua2305

Yes, let's try this

almet avatar Oct 20 '16 06:10 almet