I get the value return from
fields: [
{
name: "trackingCode",
type: "code",
required: true,
admin: {
language: "html",
},
},
]
which is a html script tag in my web app, the problem is that the return type is a string and not the code, i tried using JSON.parse but go error to retrieve the raw code
value passed:
<script>
(function(){
console.log("do something")
})()
</script>
@muperdev
<script>
(function(){
console.log("do something")
})()
</script>
this is the value you get?
Yeah, that's my test value
But am getting it as a string
can you try another value ?
send me the log in the network or console if it's possible
want to track down your problem
ok now you don't want this value as string?
I didn't get your point yet, that's why Im asking
on the front end how can i use it, it being a string makes that difficult
you should parse it in the dangeroussetinnerhtml
it's a little bit tricky, but I'll send you the example now
https://blog.logrocket.com/using-dangerouslysetinnerhtml-in-a-react-application/
@hasterisk
Tried this, but the problem is i want to make that goes in the head tag which i pass like this
you want to put HTML in head tag?!
the script tag is what i really want to put there
@christian015
you should add it as a child to open and close script tag
I dangerously added it to dev, seem to work
Thanks man
great, you're most welcome
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.