Issue with tagify and trailing spaces (PHP)

Wappler Version : W7 Beta 16
Operating System : Win 11
Server Model: PHP
Database Type: Docker cloud
Hosting Type: local PHP server

Expected behavior

What do you think should happen?

Item should be added

Actual behavior

What actually happens?

When having an item in a list for tagify with 2 or more spaces at the end it cannot be added

Tagify code

 <input type="text" class="form-control" id="inp_tgs" name="tgs" aria-describedby="inp_name" placeholder="Enter name" is="dmx-tagify" dmx-bind:data="serverconnect1.data.query" tag-value="to_name" tag-text="to_name" max-items="50" min-chars="0">

Data

image

See video

Similar issue I reported here.

1 Like

Have seen the same on NodeJS as well. Never reported it though.
In my case list data comes from a source - no custom text - so just adding trim was good enough.

Yes, i am trimming on save to db but can you not apply trim() to the tagify data bindings?

I tried to replicate but it worked fine for me. Will do some more testing later.

Can you try the following, instead of to_name as value use id, like tag-value="id". Want to know if the trailing spaces is affecting the value or the tag text.

Also there is a No Trim option, it seems that default tagify internally trims the values. You can add notrim="true". Perhaps the internal trimming and the non trimmed data source are the problem since the values do then not match.

Please let me know if you tried the above, it will help me finding the issue.

Adding

notrim="true"

had no effect however changing

tag-value="to_name"

to

tag-value="id"

did work so i guess the issue is with the value

Please test following update: dmxTagify.zip (9.9 KB)

That seems to have fixed it thanks.

@patrick does the update fix this issue as well with tag-text?

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.

Fixed in Wappler 7 beta 17