Hi I like chronoforms now that I think I have got the hang of it but this has me beat.
I have a CF with a 'select' the first option being 'please select' with a value = 0, I can put this in place using the wizard.
Then I have 50 more options I want to show and these may vary so I cannot put them all in by hand.
I have the 50 Name and Value pairs on my database and I can write a PHP query to fetch them out.finishing with the line
then I could write foreach($pairlist as $apair){?????} where do I go from here?
If it were a simple html form I would write in PHP
will this populate the 'select'? If so where do I put the database code ?
then, the first select having been populated and used, I want to populate a second select with name/value pairs depending on the result of the first selection. is this possible or am I being too ambitious ? Or do these have to be two seperate chronoforms ?
the first selection is one of 50 and the second is one of 20 making an effective choice of one in 1000.
any suggestions or advice welcome ?
--
Dave
I have a CF with a 'select' the first option being 'please select' with a value = 0, I can put this in place using the wizard.
Then I have 50 more options I want to show and these may vary so I cannot put them all in by hand.
I have the 50 Name and Value pairs on my database and I can write a PHP query to fetch them out.finishing with the line
$pairlist = loadRowList();
then I could write foreach($pairlist as $apair){?????} where do I go from here?
If it were a simple html form I would write in PHP
{ echo "<option value=$apair[1]>$apair[0]</option>";}
will this populate the 'select'? If so where do I put the database code ?
then, the first select having been populated and used, I want to populate a second select with name/value pairs depending on the result of the first selection. is this possible or am I being too ambitious ? Or do these have to be two seperate chronoforms ?
the first selection is one of 50 and the second is one of 20 making an effective choice of one in 1000.
any suggestions or advice welcome ?
--
Dave
Hi Dave,
Here's an extract from a recent form with a database drive drop-down. This is all in the form html and is in three chunkgt (a) the db lookup, (b) create an options array (including setting teh selected value) (c) display the select box.
Bob
PS It happens to be in Dutch but the steps should still be clear.
Here's an extract from a recent form with a database drive drop-down. This is all in the form html and is in three chunkgt (a) the db lookup, (b) create an options array (including setting teh selected value) (c) display the select box.
$query = "
SELECT `cf_id`, `event_name`
FROM `#__gh_eventementen`
ORDER BY `event_name`
";
$db->setQuery($query);
$eventement = $db->loadAssocList();
$event_options = "";
foreach ( $eventement as $v ) {
if ( $v['cf_id'] == $oproep->eventement ) {
$select = "selected='selected'";
} else {
$select = "";
}
$event_options .= "<option value='".$v['cf_id']."' $select >".$v['event_name']."</option>";
}
. . .
?>
. . .
<!-- Eventement -->
<div class="form_item">
<div class="form_element cf_dropdown">
<label class="cf_label" style="width: 150px;">Het was dit event</label>
<select class="cf_inputbox" id="select_4" size="1" title="" name="eventement">
<option value="">Kies het evenement</option>
<?php
echo $event_options;
?>
</select>
</div>
<div class="cfclear"> </div>
</div>
Bob
PS It happens to be in Dutch but the steps should still be clear.
Thanks Guys,
With your help I have got my chronoform with the detais I want pre set.
The is car make and car model. The client can change them in hte text-box if they are not correct.
Then I need his email so that the message sent to head office can be connected.
But I already have that so I did the same, dug the email out of the database and pre set it in a textbox.
But in use the email box gets filled with javascript stuff which says it is there to protect the email address !
Ah I thought, the cure for this is to put the email address in as a hidden value then it will not need protection.
But now when I look at debug the hidden box has no value . SO something is still losing it.
Is there a cure for this? or perhaps a better way of doing it?
All help welcome !
--
Dave
here is the form code
With your help I have got my chronoform with the detais I want pre set.
The is car make and car model. The client can change them in hte text-box if they are not correct.
Then I need his email so that the message sent to head office can be connected.
But I already have that so I did the same, dug the email out of the database and pre set it in a textbox.
But in use the email box gets filled with javascript stuff which says it is there to protect the email address !
Ah I thought, the cure for this is to put the email address in as a hidden value then it will not need protection.
But now when I look at debug the hidden box has no value . SO something is still losing it.
Is there a cure for this? or perhaps a better way of doing it?
All help welcome !
--
Dave
here is the form code
<?php
$modl = JRequest::getVar('carmodel'); //get an id from previous page
$db = & JFactory::getDBO();
$qry = "select ".$db->namequote('model').
" , " .$db->namequote('make').
" from " .$db->namequote('jos_1_carmodels2').
" where ".$db->namequote('id').
" = " .$db->quote($modl).
";" ;
$db->setQuery($qry);
$row = $db->loadRow();
$model= "$row[0]";
$make = "$row[1]";
$session = & JFactory::getSession(); //email was stored in session earlier
if($session->has('email'))
{
$theemail = $session->get('email');
}
else
{
$theemail = 'unknown';
}
?>
<div class="form_item">
<div class="form_element cf_heading">
<h1 class="cf_text">Car Details</h1>
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_textbox">
<label class="cf_label" style="width: 150px;">Car Make</label>
<input class="cf_inputbox" maxlength="150" size="30" title="" id="make" name="make" type="text" value = "<?php echo $make; ?>" />
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_textbox">
<label class="cf_label" style="width: 150px;">Model</label>
<input class="cf_inputbox" maxlength="150" size="30" title="" id="model" name="model" type="text" value = "<?php echo $model; ?>" />
</div>
<div class="cfclear"> </div>
</div>
<input value="" id="hidden_3" name="hidden_3" type="hidden" value = "<?php echo $email; ?>" />
<div class="form_item">
<div class="form_element cf_button">
<input value="Submit" name="button_4" type="submit" />
</div>
<div class="cfclear"> </div>
</div>
Hi Dave,
You have the Joomla Email cloaking plugin turned on. If you change the order of the plugins to swap around the ChronoForms Plugin and the Email Cloaking plugin this should go away.
Bob
You have the Joomla Email cloaking plugin turned on. If you change the order of the plugins to swap around the ChronoForms Plugin and the Email Cloaking plugin this should go away.
Bob
Bob - where would I change this order??
In my plugins page, I see "chronocontact" as a "Content" plugin at position 0, and I see "Content - Email Cloaking" as a "Content" plugin at position 5. Do I need to swap chronocontact to be below the email cloaking?
In my plugins page, I see "chronocontact" as a "Content" plugin at position 0, and I see "Content - Email Cloaking" as a "Content" plugin at position 5. Do I need to swap chronocontact to be below the email cloaking?
Yes, for the record I figured out that the email cloaking must be processed ABOVE the chronocontent. This is most likely so that the email cloaking finishes processing the email address (and removing script tags) by the time chronocontent is ready to display.
See I'm learning little by little.😉
See I'm learning little by little.😉
I tried using the example code a a start point but I could not get it to work.
I need to populate a dropdown box with titles from joomla usergroups:
$query = "
SELECT `jml_usergroups`, `title`
FROM `jml_usergroups`
ORDER BY `title`
";
Thank you in advance for your help.
I need to populate a dropdown box with titles from joomla usergroups:
$query = "
SELECT `jml_usergroups`, `title`
FROM `jml_usergroups`
ORDER BY `title`
";
Thank you in advance for your help.
Hi CraigMartin,
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.
Bob
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.
Bob
Using Joomla Version 1.7.2. ChronoForms 4.0 RC2.0
This topic is locked and no more replies can be posted.