Tagify field: Array to string conversion error

Hey guys.
I’m trying to write data to a tagify field but when saving, the system returns an error: “Array to string conversion”.
In Mysql the field is as TEXT.
In Wappler in Imput $_POST I did tests with the Text to Array type field.
What did I miss here?



From what I know:

  • Your mysql field I think it should be JSON type…
  • And your POST variable in your server Action should be ARRAY type

Please check it

Hello, @famousmag.
I did as you advised but still got the same Array to String error.

The error occurs on database update…
Can you share screenshots of the database updater?

Here is the video when I try to update the data.



I had configured it here. Even so, it appears as Text. Do I have to update any more items or restart Wappler? I’m working on version 6.05.


I think if you just open the database updater, delete that specific field (pcr_exclusive_benefits) and then readd it it will recognize it…

Can you try it?

Perfect. I was able to update this field in Mysql.
Now the following happens. When I refresh the page, the field with tagify shows the content and then disappears. See the video please.


In this case, this field is a normal input that should save items like:
Content 1
Content 2 with texts
One more content.
I want to display the website as if it were a list of items one below the othertagify_9
1 Like

you obviously have to use the .parseJSON() formatter in your tagify dmx-bind:value attribute…

example:
dmx-bind:value="srvc_prdView.data.qr_Prod_Details.prd_Tags.parseJSON()

srvc_prdView.data.qr_Prod_Details.prd_Tags is my qyery value of the tagify content (the json field we talked earlier)

OK.
This is my input field on the form:

<input type="text" class="form-control" id="inp_pct_exclusive_benefits" name="pct_exclusive_benefits" dmx-bind:value="sc_pacote_details.data.query.pct_exclusive_benefits.parseJSON()" aria-describedby="inp_pct_exclusive_benefits_help" required="" data-msg-required="Required field." is="dmx-tagify" dmx-bind:data="sc_pacote_details.data.query" tag-text="pct_exclusive_benefits" tag-value="pct_exclusive_benefits" dropdown-position="input" max-items="5" nocustom="true">

Continues with the same behavior

Haven’t used custom content on tagifies and I’m stuck now…

Please check this and I will see it again later:

Hello.
Well, I followed this tutorial but I still didn’t succeed. I’ll keep trying here and if I can help, it doesn’t matter what time it is. Thank you very much for your attention for now.

1 Like

Marcos, how you insert and use custom values in your tagify?

Have you checked this?

I’m on mobile (lunching with my son), when I return I’ll have a better look and test it my friend

Hello.
I managed to make it work. It was the input field that was misconfigured. Thank you very much.
Now I’m trying to show this field on the front:
[“All-inclusive Dining”, “Seaplane Transfers”, “60-Min Overwater Spa Treatment”, “Floating Breakfast”, “Complimentary Water Sports”] in list form:
. All-inclusive Dining
. Seaplane Transfers
. 60-Min Overwater Spa Treatment
. Floating Breakfast
. Complimentary Water Sports
Could you tell me how to do this?

1 Like

Hey Marcos,

First I apologize for giving you wrong advices…
You don’t need the .parseJSON and it is not correct to use it
Because when using a JSON field then you should be able to directly use it as a repeat sourse ( but you probably understood that by yourself). I’m sorry my friend!

Now, as far as I got it right, you need to list the tagify content values the one below the other…
Like that?


On the left column, the upper one (grey) the json fields are inside the tagify and below that (light blue) the json field contents are listed the one below the other

If this is what you want you can use a repeat based on your query’s json field and list them:

<div class="row" is="dmx-repeat" id="repeatTagsList" dmx-bind:repeat="sc_pacote_details.data.query.pct_exclusive_benefits">
       <legend class="col-form-label m- lh-1 fw-bold" dmx-text="'- '+$value">The Legend</legend>
</div>

you can get each value using the $value

I hope it is clear for you and works fine!

(At least for me it works like a charm)

1 Like

Perfect. Exactly what I needed. Thank you very much for your help my friend.

1 Like