VIA URL PASSING VARIABLES

fabaya 24 Mar, 2010
I need to pass a variable or at least the name of the link that call a chronoform form and then when the popup window with the chronoform appear in that popup and the user complete the form, the submision of the form contain that variable contained in the link. So the data summited by the user of the form plus the variable of the link that open the form can help me to identify the product of interest of the user without to ask the user what is the product of interest or build one form for every product. Is this posible with cronoform? Can you make an example? Im really stuck in this...I need simple examples.

Thanks a lot
GreyHead 24 Mar, 2010
Hi fabaya,

You can add varialbes to the url as usual and then acces them in the Form HTML with
<?php
if ( !$mainframe->isSite()) {return;}
$var = JRequest::getVar('var_name', 'default_value', 'get');
?>
and then use $var

Bob
fabaya 24 Mar, 2010
Hi, bob thanks for your speedy reply

Ok I make a link for every product like this in my html page:

http://localhost/Site/rafa/acceso/index.php?option=com_chronocontact&chronoformname=contextacto&prod=plane

In Form Code / Form HTML i added:

<?php
if ( !$mainframe->isSite()) {return;}
$var = JRequest::getVar('prod', '0', 'get');
?>


In Email template:

Product: {prod}

Or

Product: $prod

Or

Prduct: prod

But the email arrives with the same tag and not the value "plane" for product set in the submision link that open the cronoform formulary.

Sorry Im total newby
GreyHead 24 Mar, 2010
Hi fabaya,

In the form HTML you need to add the value into a hidden input
<?php
if ( !$mainframe->isSite()) {return;}
$prod = JRequest::getVar('prod', '0', 'get');
?>
. . .
<input type='hidden' name='prod' value='<?php echo $prod; ?>' />


Bob
fabaya 24 Mar, 2010
Bob, you are the MAN! Thanks a lot for your help!!!
fabaya 24 Mar, 2010
Ok bob, sorry. Its me again. I touch some configuration and now the form doesnt send the variable again. I made a more simple form
<?php
if ( !$mainframe->isSite()) {return;}
$var = JRequest::getVar("prod", "0", "get");
?>
<div class="form_item">
  <div class="form_element cf_textarea">
    <label class="cf_label" style="display: none;">Comentarios</label>
    <textarea class="cf_inputbox" rows="3" id="text_12" title="" cols="30" name="comentarios"></textarea>
    
  </div>
  <div class="cfclear"> </div>
</div>

<input value="<?php echo $prod; ?>" id="prod" name="prod" type="hidden" />

<div class="form_item">
  <div class="form_element cf_button">
    <input value="Enviar" name="button_5" type="submit" />
  </div>
  <div class="cfclear"> </div>
</div>


But the tag come with nothing in it.

I probe double and simple quotes

Sorry again
fabaya 24 Mar, 2010
A more simple form because im Stupid!!

<?php
if ( !$mainframe->isSite()) {return;}
$var = JRequest::getVar('prod', '0', 'get');
?>

<input value= "<?php echo $prod; ?>" id="prod" name="prod" type="hidden" />

<div class="form_item">
  <div class="form_element cf_button">
    <input value="Enviar" name="button_5" type="submit" />
  </div>
  <div class="cfclear"> </div>
</div>
GreyHead 24 Mar, 2010
Hi fabaya,

You have an extra space after value= but otherwise the code looks OK.

Please turn debug on and see what results you get.

Bob
fabaya 24 Mar, 2010
Submission link:



Submission with variable link:

http://localhost/Site/rafa/acceso/index.php?option=com_chronocontact&task=send&chronoformname=test&prod=plane

Default url of chorontact form:

http://localhost/Site/rafa/acceso/index.php?option=com_chronocontact&chronoformname=test



General: email the results? Set to yes
Form method: post
Load css/js files: yes

ChronoForms handle my posted arrays: yes

Debug: on / TOKEN: on / Enable mambots: no

Setup emails: ok / green

Email template

Only the tag: {prod}

Form code:

<?php
if ( !$mainframe->isSite()) {return;}
$var = JRequest::getVar('prod', '0', 'get');
?>
<value="<?php echo $prod; ?>" id="hidden_0" name="prod" type="hidden" />

<div class="form_item">
  <div class="form_element cf_button">
    <input value="Submit" name="button_1" type="submit" />
  </div>
  <div class="cfclear"> </div>
</div>


DB connection: no


Debug:

Form passed first SPAM check OK
Form passed the submissions limit (if enabled) OK
Form passed the Image verification (if enabled) OK
Form passed the server side validation (if enabled) OK
$_POST Array: Array ( [button_1] => Submit [31f918a907304e22d55b76045821949d] => 1 [1cf1] => 9890a652459e5f5e30f4792161966aa0 [chronoformname] => test )
$_FILES Array: Array ( )
Form passed the plugins step (if enabled) OK
An email has been SENT successfully from (aaa) [email]xxxx@gmail.com[/email] to [email]xxx@gmail.com[/email]
Debug End

Total results:

I receive an email only with the tag

{prod}

Not PLANE

But now with a special gift every time tha I try to probe the modifications

You are not allowed to access this URL

Im gonna kill my self!!!!

Thanks again bob, I know this is a hard job.
GreyHead 24 Mar, 2010
Hi fabaya,

But to get that value into the Form HTML it has to be on the URL used to call the form
http://localhost/Site/rafa/acceso/index.php?option=com_chronocontact&chronoformname=test&prod=plane
There;s no point in adding it to the onsubmit URL - you can just pass the value in a hidden input??

Bob
fabaya 24 Mar, 2010
Bob I use this link


http://localhost/Site/rafa/acceso/index.php?option=com_chronocontact&chronoformname=test&prod=plane


OR


http://localhost/Site/rafa/acceso/index.php?option=com_chronocontact&chronoformname=test&prod=car


to send the value plane or car and contextualize the form for every product. Avoinding the need of my users must select the producto in a more general form with dropdown menu

I dont know how I made once with your support, but I made it. Unfortunately I later modify the form to add some extra fields via wizard and stoped working.
GreyHead 24 Mar, 2010
Hi fabayz,

If you use Wizard Edit you lose any manual changes that you have made to the form :-( There is a big message that tells you that.

I'm afraid that you'll need to make them again (and then not use the Wizard Edit with that form).

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