Forums

Radio Buttons Not registering

john2aus 08 Aug, 2009
Hi,

My form here has radio-buttons in it. When the form is emailed to me, it does not tell me which radio button was selected - how can I correct this?

The email templete has this:
Un-Powered Site {radio} $10pp


Also, the html for the form is: (see site).

Thanks.
GreyHead 08 Aug, 2009
Hi john2aus,

Change the form html so that the buttons have distinct values
<td align="right">
<label>
Dorm
<input id="dorm0" type="radio" value="dorm 15" name="radio"/>
$15pp
<br/>
</label>
<label>
Powered Site
<input id="dorm1" type="radio" value="powered 15" name="radio"/>
$15pp
<br/>
</label>
<label>
Un-Powered Site
<input id="dorm2" type="radio" value="un-powered 10" name="radio"/>
$10pp
<br/>
</label>
</td>
and then add Accommodation: {radio} in your Email template

Bob
john2aus 08 Aug, 2009
Thanks.

Only one question, I want a dynamic subject of: New form from %name% - how can I do this?

I tried: New form from {name} - but it did not work.
GreyHead 08 Aug, 2009
Hi john2aus,

Just name - no brackets or quotes

Bob
john2aus 10 Aug, 2009
Hi,

Yes that works for me but is it possible to integrate it into sentence, e.g: "New form from %name%" ?

Also, what is the "id" for the IP address? Is it just ip (if I want the IP address to be the subject)?
GreyHead 10 Aug, 2009
Hi john2aus,

You can't put an expression in the Dynamic Subject - but you can change the value of the field in the OnSubmit Before box
<?php
$name = JRequest::getVar('name', '', 'post');
$subject = "New email from ".$name;
JRequest::setVar('subject', $subject);
?>


You can add the IP address in here - I forget exactly what the code is but it's in the AutoGenerated code for any form that saves to a table.

Bob
john2aus 10 Aug, 2009
Hi Bob,

That one is not working for me (I kept my dynamic subject as "name" and did what you suggested). Should it instead be:

<?php
$name2 = JRequest::getVar('name', '', 'post');
$dynamicsubject = "New email from ".$name2;
JRequest::setVar('dynamicsubject', $dynamicsubject);
?>


Does changing $name to $name2 make any difference? Should I now put "name2" in the dynamic subject?

Also, should it be $dynamicsubject instead of $subject?

Thanks for your quick response.
GreyHead 10 Aug, 2009
Hi john2aus,

You need the variable name in there - in your code it's dynamicsubject

Bob
john2aus 10 Aug, 2009
Hi Bob,

I tried this with a dynamic subject (with the value "name") in the email template but it did not work:

<?php
$name = JRequest::getVar('name', '', 'post');
$subject = "New email from ".$name;
JRequest::setVar('dynamicsubject', $subject);
?>


What am I doing wrong?
GreyHead 10 Aug, 2009
Hi john2asu,

You need the variable name in the Dynamic Subject box - in your code it's dynamicsubject

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

VPS & Email Hosting 20% discount
hostinger