Forums

(solved) php in form mananger - code

?
Guest 04 Sep, 2011
hi all,

I am currently working on a form that requires me to add some php in form manager - code tab - html code. problem is that whenever I edit and save something in the wizard that is being removed again.

Is there any setting I need to change in order to prevent this from happening?

J!1.5.23, CF4 RC2.0
GreyHead 04 Sep, 2011
Hi GabrielaH,

Should bo OK but you need to set the Form Type to Custom above the HTNL Code box otherwise the Wizard will over-write the code here.

You can usually manage PHP in a Custom Code element if you want ot keep the flexibility of working with the Wizard to add new elements too.

Bob
?
Guest 04 Sep, 2011
thanks Bob!🙂

I am not sure if I can add the respective php into a custom code action/element.
what I need is to stuff a select list with values from a different table so that the amended code looks like this:
<label>Venue:</label>
<select size="5" label_over="0" hide_label="0" class=" validate['required']" title="" type="select" name="locid">
	<option value="">- Please select -</option>
	<?php $database->setQuery("SELECT * FROM #__chronoforms_data_venues ORDER BY `town`, `venue`");
	$venues = $database->loadObjectList();
	foreach ( $venues AS $venue) {
		$option  = $venue->town;
		if ($venue->venue) $option .= ', '. $venue->venue;
		echo "<option value='" . $venue->cf_id . "'>" . $option . "</option>";
	} ?>
</select>
<div id="error-message-locid"></div>

I cannot think of any way of adding this to the preview / action tab or is there?
GreyHead 04 Sep, 2011
Hi GabrielaH,

Drag a Custom Element into the Preview tab; open it and paste the <select . . . </select> part of this into the Code box. Add the label text, name & id as required (they are only used in the wrapping html).

Bob
?
Guest 04 Sep, 2011
cool! that worked! thanx again Bob!🙂
This topic is locked and no more replies can be posted.