Bric Builder: functions


I’m building my first custom bric, which will need to update some values in the HTML output.
However, I’m struggling to wrap my head around the way to get the interface ‘function’ to do this.

In the HTML view I’ve got something like:

In the Interface I’ve added a text-field:
Title: Name
Function setUIVal
Attribute: name
Value: Beachwalk Beachwear & Giftware
Tooltip: Enter the name of your business here

I’m assuming my function is the issue here. Have I interpreted incorrectly?

Anyone around that could point me into the right direction?

Nice @brechtryckaert,

I am about to launch my first custom brics too.

You will have to write a function in the custom-bric.js file to replace the text.

So it would be something like

function functionName(V) {
 // do something

In the Bric Builder, click on the magnifying glass icon it will show you the folder for that bric, and you will find the file under js

1 Like

Ok, got it. I was confused due to the documentation seemingly referencing several functions, which I assumed were already predefined. I’ll get to scripting some JS magic then :wink:

Thanks for the fast and great clarification, @Malachiman!

1 Like

Yeah, its taken me some time to get my head around it, Ive made some pretty good progress recently. @Flashman has been trialing my first “released” bric for me. I have some more in the pipeline.

I’ve got a complete Bric-pack ready, but it relies heavily on the text-value updating. The moment I have this function ready, I can add the last missing piece of the puzzle to my already prepared brics and get them out there for testing.

Best of luck with your release!

1 Like

You too. Look forward to seeing what you have been working on.

Funny enough, I have another Bric that has been held up by something I could not solve. @Whittfield was very kind enough to give it some though and make a suggestion for me that solved my issue.

Be good to see some more discussions around this topic.