Forums

Parsing value's from an article / url into a form

digitaldancefloor.com 07 Oct, 2011
Hi,

I have an article which is a "competition". I want to have a link in the article to "Enter Competition". This would be a link to the chrono form.

What I want to do is carry the "title" of the article into the form, so I know what competition each entry goes with. If not the title - something meaningful that I can hardcode into the url...

i.e. I have an article for Vip Tickets to an event on 31/12/2011"
i could add a link "index.php?option=com_chronocontact&chronoformname=competition&entrytitle="viptickets31122011"

How do i parse the "viptickets31122011" into a field.... or is there a simple way to just parse the article title / id / do a lookup??

I am a little fresh with joomla and php so please excuse my ignorance!

Blown away by chron forms so far... very flexible. 😀

cheers,

nick
GreyHead 09 Oct, 2011
Hi Nick,

Which version of ChronoForms are you using? You can find the version from Site Admin | Extensions | Install/Uninstall | Components in Joomla! 1.5 or Site Admin | Extensions | Extension Manager | Manage in Joomla! 1.6.

You can get the URL value in Joomla! with
<?php
$title = JRequest::getString('entrytitle', '', 'get');
?>

What happens after that depends on the version.

Bob
digitaldancefloor.com 09 Oct, 2011
Hi Bob,

Thanks for getting back to me. I don't seem to have any luck.

The code I use in the form code is:

<input value="<?php
$title = JRequest::getString('entrytitle', '', 'get');
?>" maxlength="150" size="30" id="text_3" name="title" type="text" />

I have a url of:

index.php?option=com_chronocontact&chronoformname=competitions&entrytitle=testcompetition

I have had it working on another field in another form which gets the users email address if they are logged in.

I have tried adding

echo "{$title->title}"; just below the $title line and no joy.

I am using version 3.2.0 - I just literally downloaded and purchased a few days ago.

Any thoughts on what I am doing wrong?

Thanks so much for your help.

Nick
GreyHead 10 Oct, 2011
Hi digitaldancefloor.com,

This code will only assing the value to the $title variable. It will not output it anywhere.
<?php
$title = JRequest::getString('entrytitle', '', 'get');
?>

Please try this instead
<?php
echo JRequest::getString('entrytitle', '', 'get');
?>

Or even better - as it keeps the code cleaner:
<?php
$title = JRequest::getString('entrytitle', '', 'get');
?>
. . .
<input value="<?php echo $title; ?>" maxlength="150" size="30" id="title" name="title" type="text" />

Bob
digitaldancefloor.com 10 Oct, 2011
Bob, You are a star! It works perfectly!

Thank you for your help!

kind regards,

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