WebsiteBaker Support (2.10.x) > Modules

Automatically add content to a field in Miniform ...?

(1/2) > >>

astricia:
Is there a way to automatically add content to a certain variable in a Miniform template?

I am working on a website for an industrial company with the entire product catalogue on the website. The client would like a contact form on each individual product page to request more information. I was thinking of realizing this with Miniform - but I would like to automatically add the Name of the Product and/or the Product number to the form, so that my client will know about which product they need more information.

Anybody can put me in the right direction, so that I don't have to set up 200 different contact forms... ?

Thanks,
Astrid

dbs:
Hi, had done it before some weeks, but ... i forgot how.
With OFA, item-name in $_SESSION, hidden input field in miniform template and there a droplet what read the $_SESSION['item-name'].

I think Ruud will have a better way.

Ruud:
https://miniform.dev4me.com/module-help/tips-and-tricks/ (Field data in links)

The formnames wihout mf_ or mf_r_ can be used as parameter in the url.
Just create a link to your formpage like yoursite.com/pages/formpage.php?fieldname=value&otherfieldname=othervalue

Using OFA or Bakery you could use the output template like:
--- Code: ---<a href="https://yoursite.com/pages/formpage.php?product=[TITLE]&sku=[FIELD_1]">Order</a>
--- End code ---

astricia:
Ok, I can get the link to have a ?product=[TITLE] in it (I have built the product catalogue with OFA of course....), but it doesn't show up in the contact form.

What is the exact call for the field in the form itself? I have

--- Code: --- <div class="full">
<label for="product"><span>Anfrage für </span>
<input class="{PRODUCT_ERROR}" type="text" id="product" name="product" value="{PRODUCT}" />
</label>
</div>
--- End code ---

And does it matter that the Title of the OFA Item contains spaces?

Ruud:
In miniform all form fields start with mf_ or mf_r_

So name="product" should be name="mf_product" or name="mf_r_product". (no changes to the rest)
That way your link should work.

Navigation

[0] Message Index

[#] Next page

Go to full version