How do I pull the id out of the URL... and put it in the app/model so I can pass it from page to page?

how do I pull the id out of the URL… and put it in the app/model so I can pass it from page to page?

In your FM hook:

set var $someKey = JSONGetElement ($$BF_Query ; "someQueryKey" )
set var $$BF_App = JSONSetElement ($$BF_App ; "someKey" ; "someKey" ; $someKey ; JSONString )

Is there a way to do it native in betterforms? I am trying not to use FM unless I have too? Also… I need to know how to grab the id… for instance… https://xxx.xxx.xxx/#/jobapplication?id=6E590354-D519-4424-9EAA-9E5804BE9210

now when I click the next button I want to pass it to the next page…

Yes, if you’re not running a hook in FM, you can use BF.getQueryParam(key) as seen here in the docs. That can be used in a function action all without running a hook.

So where do I place that function in betterforms? is this an action? and how do I bring it into the model? I don’t see any sample code

This is the JavaScript code, pulling it from the query in the URL and then setting it into your app model.

app.myKey = BF.getQueryParam('someQueryKey')

Anywhere that you can run actions, you can include a function action that runs that JavaScript code

so this is what I have… but its not working…
{
“action”: “path”,
“function”: “app.application=model.application , app.position=model.position, app.application.id = BF.getQueryParam(‘id’)”,
“options”: {
“path”: “/terms”
}
}],
“buttonClasses”: “btn btn-info”,
“styleClasses”: “col-md-6”,
“text”: “Next”,
“type”: “button”
}

This is the URL I am trying to pull from…

You have a typo in the word Query on your code

1 Like

haha… thx… I copied it… but not sure from where… It would be great to have more examples to help us…