Automatic field, model's field depends on another field

Hey!

Let’s suppose that I have a blog model (and about 200 entries from it) with 3 type of inputs: title, description, url.

Is it somehow possible that I bind the url field to the value of the title using custom js code?

If the title is: “My first blog article?”
I want that my url automatically will be: “my-first-blog-article”, because it can be very tedious to add this url manually each time

Something like

url=state.title.toLowerCase().replace(" “,”-").replace("?","")

Or something like that.
Please let me know if it is possible, because it would be a very convenient way of solving this auto binding issue.

Hey @radikris!

While this video is a little older, you’ll find your answer here: Dynamic urls with advanced fetching in Builder.io - YouTube

You can edit the URL of the page using state.location.path.

Thank you, and please let us know if you have any further questions!

thanks @logan ,but I think you misunderstood my question:

I have this model entry:


I want to generate an url for this automatically from the title, with this rule:
url=state.title.toLowerCase().replace(" “,”-").replace("?","")

So this way, the url would be first-personal-question, without I have to type that manually. Is it possible?

Thank you for clarifying!

That isn’t possible right now, but you can submit a feature request for an auto-generated Slug field at our Ideas page. This is a great idea!

1 Like

Thank you very much for your response @logan !
Can you please help me:

@TimG is out of stock, and I need this urgent. Thank you very much!

Hey @radikris,

I’ve reached out to my Customer Engineer team to take a look at that forum post. Thank you!