Forums

Dynamic Information From Custom Textbox

melvins138 15 Jun, 2017
Hello,

I have a form that auto-populates an email address from the database when a user is logged on.

I am using this code:
	<div class="gcore-subinput-container" id="fitem">
		<label for="custom" class="control-label gcore-label-top">Email</label>
			<div class="gcore-input pull-left gcore-sub-input gcore-display-table" id="fin-custom">
				<?php
				$user =& JFactory::getUser();
				$email = '';
				$readonly = '';
					if ( $user->id > 0 ) {
						  $email = $user->email;
						  $readonly = "readonly='readonly'";
					}
				?>

				<div class="ccms_form_element cfdiv_text" id="email_container_div" style="">
  					<input id="email" placeholder="" class="validate['required','email'] form-control A" title="" style="" data-inputmask="" data-load-state="" data-tooltip="" value=" <?php echo $email; ?> " name="email" type="text" <?php echo $readonly; ?> />
					  <div class="clear"></div>
					  <div id="error-message-email"></div>
				</div>
			</div>
	</div>


When I add {email} to the Dynamic from email, it is not recognizing the field. So it's sending the email from ROOT @localhost, and not the user's email.

When I place {email} in the email body, it loads fine.

How do I get that custom data into the Dynamic from email field?

EDIT: I am noticing that no Dynamic fields are loading. I have a field for subject, and this is a field that the user types in information. I tried adding "Supporting Member: {subject}" to the Dynamic subject. That it is not loading either, but again it shows up in the email body.

I also have a display message, and the {email} and {subject} display on it fine.


Thanks,
Melvins
GreyHead 15 Jun, 2017
Answer
Hi Melvins,

Please leave off the {} in the Dynamic Email fields - just use the input element name with no brackets or quotes.

Bob
melvins138 15 Jun, 2017
UGH!!! What a rookie mistake.

Thanks Bob.

Follow Up Question: I need the subject to be Supporting Member: {subject} so that I know it comes from someone I need to respond to fast.

How can I add the constant "Supporting Member:" to the beginning of the dynamic subject?

Thanks,
Melvins
melvins138 15 Jun, 2017
Bob, you are the MAN!!!

Thanks for putting up with my basic questions.

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