WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.9 R22 is now available!


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker

Your donations will help to:

  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!

You can donate by clicking on the button below.


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.10.x) »
  • Modules »
  • Automatically add content to a field in Miniform ...?
  • Print
Pages: [1]   Go Down

Author Topic: Automatically add content to a field in Miniform ...?  (Read 18423 times)

Offline astricia

  • Posts: 783
  • Gender: Female
    • netSchmiede24
Automatically add content to a field in Miniform ...?
« on: October 04, 2018, 08:45:59 AM »
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
Logged

Offline dbs

  • Betatester
  • **
  • Posts: 8926
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: Automatically add content to a field in Miniform ...?
« Reply #1 on: October 04, 2018, 09:15:56 AM »
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.
Logged
https://onkel-franky.de

Offline Ruud

  • Posts: 3671
  • Gender: Male
  • Do not use PM for help! Please use the forum!
    • Dev4Me - Professional WebsiteBaker Development
Re: Automatically add content to a field in Miniform ...?
« Reply #2 on: October 04, 2018, 10:31:24 AM »
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: [Select]
<a href="https://yoursite.com/pages/formpage.php?product=[TITLE]&sku=[FIELD_1]">Order</a>
Logged
Dev4me - WebsiteBaker modules - WBhelp.org

Offline astricia

  • Posts: 783
  • Gender: Female
    • netSchmiede24
Re: Automatically add content to a field in Miniform ...?
« Reply #3 on: October 04, 2018, 01:25:16 PM »
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: [Select]
<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>

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

Offline Ruud

  • Posts: 3671
  • Gender: Male
  • Do not use PM for help! Please use the forum!
    • Dev4Me - Professional WebsiteBaker Development
Re: Automatically add content to a field in Miniform ...?
« Reply #4 on: October 04, 2018, 01:52:26 PM »
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.
Logged
Dev4me - WebsiteBaker modules - WBhelp.org

Offline astricia

  • Posts: 783
  • Gender: Female
    • netSchmiede24
Re: Automatically add content to a field in Miniform ...?
« Reply #5 on: October 05, 2018, 09:51:58 AM »
Perfect - thanks! :-)
Logged

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.10.x) »
  • Modules »
  • Automatically add content to a field in Miniform ...?
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2