How to exclude certain characters when submitting text to a field in a database?

Hi !

So my issue is that my links are built with the name of the item, and if certain symbols are present in the title, they make a mess and lead to a 404. (such as %, &, +).
Example (click, then refresh and it will lead to a 404) :
My idea is to create a field in my collection that copies the name of the item upon submission by the user, and takes away all the problematic characters (such as &, % and +). It would then be used in the Wix Editor’s page settings to build links.

Any idea how to code this ?

Basically my code would look like this :

// button which submits the form with all the data needed (name of the item, price, name of the vendor...)
export function button15_click_1(event, $w) {

//text83 would take the value of the TITLE of the item (as inserted by user in input5) without taking into account special characters such as % & and +.
$w('#text83').text = $w('#input5').value;
//???? part missing to create some kind of RegEx

// the Fixed Title, ready for URL usage is set into its field in the database. This field will be used in the Wix Editor to build links for items' pages in this dataset
$w('#dataset1').setFieldValue('TITLEFIXED', $w("#text83").text);


You can also work with → splice, slice, split, substring and so on

What does that mean ? Any idea what the code look like?


and so on…

You can generate your new link by -->converting, cutting, replacing, removing, joining and doing what ever with your —> link-STRING.

Or you do it with regEx, but i think this would be a little bit more complicated, if you do not understand regEx.

Thanks, but I couldn’t really find any info that would “remove” characters. (I’m newbie lol)

This is all what you can do with a STRING…