How to pass Pro Forms submission data to Ajax function?

In BF panel, I want to create an Ajax function that uses values from a Pro Forms submission. From the tutorial video, I see that it’s possible to add static values to the function data. But how would I add dynamic values?

Which video do you mean? Calling Ajax functions is coming in the next version. Or are you talking about the custom javascript action of the Bricksforge Panel?

In any case, you have access to the entire event data using template variables: Bricksforge Panel – Bricksforge Docs

Also, with the next version, there is a more flexible way of accessing event data.
Example: {event:target:value} will be parsed as: event.target.value. This way you can use nested object data for the input fields.

I’m using the Ajax Function added in 1.0.2.

How do I reference Pro Forms fields using template variables?

I have the exact same question.

In Function Data how we set the value to be one from the Form fields?

@ okadrian did you find a solution?

The 1.0.5 release added the flexible variable syntax that Daniele described in this thread, but I haven’t tried it yet. Based on the docs, you should be able to use {event:target:value} as the value for Function Data.

To get the value of the Pro Form field, try using {event:target:fieldID:value}. Replace “fieldID” with the ID of the field.

Not sure if this is supported in BF, but it seems logical. @Daniele will this work to target Pro Form fields in the Ajax Function?

@Moultrex Please give it a try and let me know if it works.

No it does not work. It gets what ever you put there as string.

For example i put {event:target:tpmqdk:value} and in the variable the text {event:target:tpmqdk:value} was assigned as is. Did not get the field value.

Very unfortunate.

You cannot pass formdata using the submit event, because this event is not storing this data. If you want to pass form data to a custom php function, I would do this completely on server side using the “Custom” form action.

It took me a while to work this out and this thread directed me towards the answer. I thought I’d add what worked for me. I’m using a click event not submit to send a server generated code to the supplied email. I verify the code and email in a custom action on submission before registering a new user.

I misread @Daniele’s answer as it couldn’t be done for any event, but it’s straightforward in hindsight. This has had 175 views but only 8 clicks on the linked help document. I tried all the suggestions before reading the docs. :wink: {formField:fieldName}

image