Precompiled fields (different and not always)

damconsulting 13 Mar, 2017
Hi, i'm using CF4 for a booking form for a medical center; there is a single form called from different website pages (with plugin {chronoforms}booking{/chronoforms}) and this form as a text field where people can write which medical examination they need. It could not be a dropdown list because there should be a lot of variations.
Everything works fine.

That form is call also from specific pages (i.e. oculist) and people need to write "eye examination" in text field.
Is there any way to pass and precompile that "text_field" with a parameter different for every starting page?
For example: if I call form from oculist page i'd like to have "eye examination" precompiled or if I call form from cardiologic page i'd like to have "heart examination" precompiled and so on.

Thank you.
DAM
GreyHead 13 Mar, 2017
Hi Dam,

In Cfv5 you can add a parameter to the plug-in code - but not in CFv4. What I think that you'd need to do is capture the page title or URL and use a Custom Code action in the form On Load event to set the value. Basically something like this:
<?php
// code to get title or URL or Menu name
switch ($url) {
  case 'aaa':
   $text = 'aaa';
   break;
  case 'bbb':
 . .  .
}
$form->data['var_name'] = $text;
?> 

Bob
This topic is locked and no more replies can be posted.