Page URL Tag or Equivalent Liquid Markup?

Is there a liquid markup or module tag I can use as a “value” to fill in a field for a form, that way I can identify the page URL when workflow notifications come for a product quote form?

Or would I just need to create a new custom property with the URL manually entered, to use that property as the value in the form field?

The request object can provide details about the current page URL:

And so you can populate a form field with that information, for example:

<input type="text" name="YOUR-FIELD-NAME" value="{{request.request_url.href}}">

You would need to add this field as a custom form field in the form builder so that it submits the data though.

1 Like

Thanks Adam, that worked like a charm!

Adam, another question, what about outputting a custom web app property to use as a value on another form field? I’m using the one below for one of the custom module I created to disaply a title/name of the web app item:

name of the custom property is “ProductName” and I want it to be a value just like the URL earlier.

For some reason, it only populates this field when the form scripts are within the module layout, but when I use the form tag instead in the layout, it does not display at all inside the form field.

{% component type: “form”, alias: “wfs_request_for_quote_product_specific” %}

Yes, by default, the module properties are scoped to work inside the Layouts only.
But there are ways to pass or retrieve this data outside of the module items layout… depending on your use case.

Is your form still rendering on the same page as the Custom Module item?
and is the form below the layout markup?

Or is your form on another page and just linked to from the custom module item page?

Hi Adam,

The form tag is within the custom “post detail” layout on the same page. The form renders on a modal popup when a request for quote button is clicked (but the form tag is within the post detail layout).

Ah, yes ok. You need to pass the specific data into the form layout via a parameter in the form component tag.

So add this to your form component:

{% component type: "form", myProductName: "{{this.ProductName}}", alias: "wfs_request_for_quote_product_specific" %}

Then, in your form code you can pick up that parameters value like this:


And so you can place this in a field value or anywhere else needed.

1 Like

I noticed when using a form (as component tag) on a detail layout of a module, the properties of the module can also be accessed like that: E.g. instead of using {{}} to get the name of the module item in the form layout, use {{}}. Putting <pre>{{this}}</pre> in the form code will show you all the data of the module the form component is embeded in (the parent section).

1 Like

Yes, very good point @TimL.
I always forget about the parent object. I think because in some cases it can be inconsistent (or at least it used to be).
But this is a very valid, and cleaner, suggestion - nice one :+1:

Thanks Adam and Tim!

It worked, I had to change {{this.params.myProductName}} to {{this.params.ProductTitle}} and it worked and now displays as a “value” on the form!

See screenshot:

The update was created on the form component tag that is inside the custom module layout template:

{% component type: "form", myProductName: "{{this.ProductTitle}}", alias: "wfs_request_for_quote_product_specific" %}

The form layout script below remains the same as you instructed:

<label for="ProductName">Product Name</label>
<input type="text" id="ProductName" name="ProductName" value="{{this.params.myProductName}}" class="sm-form-control">

It worked like a charm!

Thank you again all for the help!

Thanks Tim for the assist! I was able to make some changes to the scripts and now it works. I appreciate the help.