Forums

Dynamically add value

Riceman 30 Sep, 2009
I have a slideshow that allows a custom link for each photo, and each photo has an ID number. I want this link to open a simple form that includes this number, in the database and in the email sent out.

The form would include name, email, photo ID, comments, captcha, submit.

I have created many forms with your component, but have never tried to dynamically add a value. Is this possible, and if so can you please explain how or direct me to a tutorial?

Many Thanks for a great extension for Joomla!
GreyHead 30 Sep, 2009
Hi Riceman,

I'm not completely sure I understand but if the id is in the url than you can add it to a hidden field like this:
<?php
$photo_id = JRequest::getInt('photo_id', '', 'get');
?>
<input type='hidden' name='photo_id' value='<?php echo $photo_id; ?>' />

Bob

Note: getInt assumes that it is an integer, use getString otherwise
Riceman 30 Sep, 2009
Thanks Bob,

Well actually the slideshow is AJAX driven, so the link for each slide is not in the url, but rather an href link embedded in each slide:

<a href="chronoform_page" target="_self" class="menu" title="123">ID #123</a>

-where chronoform_page is the targeted simple form I was discussing
-and title is the slide ID

There would be say 50-70 of these slides each with a unique ID. Is there a way to pass that ID to the chronoform?

I hope this is clearer. Thanks again.
GreyHead 30 Sep, 2009
Hi Riceman,

Yes, add the ref to the href link then get it in Chronoforms as a 'get' variable.
<a href="index.php?option=com_chronocontact&chronoformname=xxx&id=123" target="_self" class="menu" title="123">ID #123</a>


Bob
Riceman 30 Sep, 2009
Great!

I have never used a get variable....could you explain a little more please if you have the time, or point to a tutorial, existing thread. I will look myself in the threads...but don't have the time right now and wanted to respond before you sign off for the day. I am in Hawaii and its 9:30 am....

Thanks
Riceman 30 Sep, 2009
I'll figure it out....

Thanks for the help.
GreyHead 30 Sep, 2009
Hi Riceman,

Just after midnight here
$var = JRequest::getVar('var_name', '', 'get');
Riceman 01 Oct, 2009
Thanks....

that's a bigger help than you know. Keep the caffeine flowing🙂
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount
hostinger