Setting up my first form in ChronoForm and things are going well so far. I have one issue though that's been a roadblock for me for the past couple hours.
My form is here
http://v2009.catsmiley.com/enlist-now.html
The issue is that the checkbox array at the bottom is not writing the concatenated string to the table field specified (infoRequest). All other fields work fine and the generated email includes the array as desired.
The form html for the checkbox section is
The email that is generated works fine as shown...
[attachment=1]email_preview.jpg[/attachment]
Database table field? blank where all the other fields are populated. The data type on the field is setup just as varchar(255)
Do I need to add extra code to the auto-generated code tab? I have tried this but it gets replaced when I go back to view it...Guess that's a result of it being "auto-generated" I currently have the email bit turned off as try to work out this issue. Debug is turned off.
Auto-Generated code is
and auto-generated tab fields are as such...
[attachment=0]ag_preview.jpg[/attachment]
Thanks for any help and let me know if any more info is required.
My form is here
http://v2009.catsmiley.com/enlist-now.html
The issue is that the checkbox array at the bottom is not writing the concatenated string to the table field specified (infoRequest). All other fields work fine and the generated email includes the array as desired.
The form html for the checkbox section is
<div id="checkboxes">
<fieldset class="required">
<legend>Interests</legend>
<label for="checkbox_1" class="labelCheckbox">
<input type="checkbox" name="infoRequest[]" id="checkbox_1" class="inputCheckbox" value="fatcamp"/>
Fat Camp</label>
<label for="checkbox_2" class="labelCheckbox">
<input type="checkbox" name="infoRequest[]" id="checkbox_2" class="inputCheckbox" value="vacations"/>
Shape Up Vacations</label>
<label for="checkbox_3" class="labelCheckbox">
<input type="checkbox" name="infoRequest[]" id="checkbox_3" class="inputCheckbox" value="wwarriors"/>
Weekend Warriors</label>
<label for="checkbox_4" class="labelCheckbox">
<input type="checkbox" name="infoRequest[]" id="checkbox_4" class="inputCheckbox" value="bootcamp"/>
Boot Camp</label>
<label for="checkbox_5" class="labelCheckbox">
<input type="checkbox" name="infoRequest[]" id="checkbox_5" class="inputCheckbox" value="jumpschool"/>
Jump School</label>
<label for="checkbox_6" class="labelCheckbox">
<input type="checkbox" name="infoRequest[]" id="checkbox_6" class="inputCheckbox" value="nutrition"/>
Nutrition Summit</label>
<label for="checkbox_7" class="labelCheckbox">
<input type="checkbox" name="infoRequest[]" id="checkbox_7" class="inputCheckbox" value="training"/>
Personal Training</label>
<label for="checkbox_8" class="labelCheckbox">
<input type="checkbox" name="infoRequest[]" id="checkbox_8" class="inputCheckbox" value="academy"/>
Academy of Fitness</label>
<label for="checkbox_9" class="labelCheckbox">
<input type="checkbox" name="infoRequest[]" id="checkbox_9" class="inputCheckbox" value="general"/>
General Enquiry</label>
<br style="clear:both"/>
<div class="checkboxRequiredMsg">Please select at least one item.</div>
</fieldset>
</div>
The email that is generated works fine as shown...
[attachment=1]email_preview.jpg[/attachment]
Database table field? blank where all the other fields are populated. The data type on the field is setup just as varchar(255)
Do I need to add extra code to the auto-generated code tab? I have tried this but it gets replaced when I go back to view it...Guess that's a result of it being "auto-generated" I currently have the email bit turned off as try to work out this issue. Debug is turned off.
Auto-Generated code is
<?php
if($paramsvalues->dbconnection == "Yes"){
$user = JFactory::getUser();
$row =& JTable::getInstance("chronoforms_enlistnow", "Table");
srand((double)microtime()*10000);
$inum = "I" . substr(base64_encode(md5(rand())), 0, 16);
JRequest::setVar( "recordtime", JRequest::getVar( "recordtime", date("Y-m-d")." - ".date("H:i:s"), "post", "string", "" ));
JRequest::setVar( "ipaddress", JRequest::getVar( "ipaddress", $_SERVER["REMOTE_ADDR"], "post", "string", "" ));
JRequest::setVar( "uid", JRequest::getVar( "uid", $inum, "post", "string", "" ));
JRequest::setVar( "cf_user_id", JRequest::getVar( "cf_user_id", $user->id, "post", "int", "" ));
$post = JRequest::get( "post" , JREQUEST_ALLOWRAW );
if (!$row->bind( $post )) {
JError::raiseWarning(100, $row->getError());
}
if (!$row->store()) {
JError::raiseWarning(100, $row->getError());
}
global $row_jos_chronoforms_enlistnow;
$row_jos_chronoforms_enlistnow = $row;
}
?>
and auto-generated tab fields are as such...
[attachment=0]ag_preview.jpg[/attachment]
Thanks for any help and let me know if any more info is required.
Hi microserf,
try to change the DB connection to be "before email" or "after email" if you have it as before email already!
let me know!
Regards
MAx
try to change the DB connection to be "before email" or "after email" if you have it as before email already!
let me know!
Regards
MAx
Hi Max
Thanks for the help. Wish I could say that did it but no such luck.
Was previously set at "before email" and switched it to "after mail" but same result. InfoRequest[] outputs to the email but not to the database table.
Thanks for the help. Wish I could say that did it but no such luck.
Was previously set at "before email" and switched it to "after mail" but same result. InfoRequest[] outputs to the email but not to the database table.
No problems, is this V3.0 stable ? if so then can you attach here your chronocontact.php file ? components/com_chronocontact/chronocontact.php
Regards
Max
Regards
Max
Should have mentioned that at the start I suppose.
Yes...V3.0 stable and here's the com_chronocontact.php file.
[attachment=0]com_chronocontact.zip[/attachment]
Thanks again
microserf
Yes...V3.0 stable and here's the com_chronocontact.php file.
[attachment=0]com_chronocontact.zip[/attachment]
Thanks again
microserf
Hi microserf,
did you turn off "Chronoforms handle generated arrays" in the DB connections tab ?
if its ON then set your connection to be "before email" and add this code to the onsubmit BEFORE email box:
Max
did you turn off "Chronoforms handle generated arrays" in the DB connections tab ?
if its ON then set your connection to be "before email" and add this code to the onsubmit BEFORE email box:
<?php
JRequest::setVar('infoRequest', implode(",", JRequest::getVar('infoRequest')));
?>
Max
Right on!! Thanks Max that did it.
[attachment=0]fieldview.jpg[/attachment]
Good to know. I wasn't sure where I would add code to customize the output.
Thanks again
microserf
[attachment=0]fieldview.jpg[/attachment]
Good to know. I wasn't sure where I would add code to customize the output.
Thanks again
microserf
No problems, this issue will get fixed in the next version!
Regards
Max
Regards
Max
Hello there,
I've been searching the forums endlessly, and tried everything that I've found, but nothing seems to work. I'm trying to enter my own code in the Auto Generated box, but it keeps getting either wiped-out or replaced by the "auto generated" version depending on what settings I have in the DB Connections tab... no matter what I try, I can't get it to show my code.
What am I doing wrong?
Thanks,
Nick.
I've been searching the forums endlessly, and tried everything that I've found, but nothing seems to work. I'm trying to enter my own code in the Auto Generated box, but it keeps getting either wiped-out or replaced by the "auto generated" version depending on what settings I have in the DB Connections tab... no matter what I try, I can't get it to show my code.
What am I doing wrong?
Thanks,
Nick.
Hi Nick,
why in the autogen tab ? you can add it in the onsubmit code box!
Regards
Max
why in the autogen tab ? you can add it in the onsubmit code box!
Regards
Max
Yay, I finally got this working. But, I was unable to get it working as described above by putting the implode code in the "Before email" section. The steps below only seemed to work if I used the several settings to post to the database after the email. (even if I don't have an email setup)
First -
In the form code, the checkbox items you want to be stored in the same field need to all have the same "name" value and this must end with double brackets [] Example:
Now, you need to make sure that the following is down lower on the same screen in the "On Submit code - after sending email:" field (I could not get this working with the before sending email option) see code here:
Next, make sure you have the following settings...
When you create your table using the create table box, use of of the field types that will support the amount of text likely to end up there. I used "blob" but some others have suggested some of the text field types - perhaps somebody can clarify. When creating your table, be sure to check the boxes for the other columns (fields) that you wanted created in your db.
Be sure that "Enable data storage" is set to yes.
On the Autogenerated code tab, set the Saving Data/Emails order to "After Email" (I tried and tried and coudl not get this to work with Before Email)
Set the "Let Chronoform handle my posted arrays" to "No" (I could never to get it to work or show the implode code in the autogenerated code)
IMPORTANT - I'm a newbie, wet behind the ears, so it's very likely that I'm missing something simple here. But... this is how I got it to work. Suggestions from the experts are certainly welcome. (Isn't the autogenerate code supposed to take care of the implode function to store the arrays in the db??)
First -
In the form code, the checkbox items you want to be stored in the same field need to all have the same "name" value and this must end with double brackets [] Example:
<DIV class=form_item >
<DIV class="form_element cf_text" ><SPAN class=cf_text >Pick a Color</SPAN></DIV>
<DIV class=clear > </DIV></DIV>
<DIV class=form_item >
<DIV class="form_element cf_checkbox" ><LABEL class=cf_label >Color</LABEL>
<DIV class=float_left ><INPUT class=radio id=Red type=checkbox value=Red name=Color[] ><LABEL class=check_label for=Red >Red</LABEL><BR ><INPUT class=radio id=_Yellow type=checkbox value="Yellow" name=Color[] >
<LABEL class=check_label for=_Yellow > Yellow</LABEL><BR ><INPUT class=radio id=_Green type=checkbox value="Green" name=Color[] >
<LABEL class=check_label for=_Green > Green</LABEL><BR >
<input class=radio id=Color[] type=checkbox value="Blue" name=Color[] >
<LABEL class=check_label for=Color[] > Blue</LABEL>
<BR ><INPUT class=radio id=_Black type=checkbox value="Black" name=Color[] >
<LABEL class=check_label for=_Black > Black</LABEL><BR ></DIV></DIV>
<DIV class=clear > </DIV></DIV> <div class="form_element cf_button">
<input type="submit" name="submit" value="Send"> </div>Now, you need to make sure that the following is down lower on the same screen in the "On Submit code - after sending email:" field (I could not get this working with the before sending email option) see code here:
<?php
JRequest::setVar('Color', implode(",", JRequest::getVar('Color')));
?>Next, make sure you have the following settings...
When you create your table using the create table box, use of of the field types that will support the amount of text likely to end up there. I used "blob" but some others have suggested some of the text field types - perhaps somebody can clarify. When creating your table, be sure to check the boxes for the other columns (fields) that you wanted created in your db.
Be sure that "Enable data storage" is set to yes.
On the Autogenerated code tab, set the Saving Data/Emails order to "After Email" (I tried and tried and coudl not get this to work with Before Email)
Set the "Let Chronoform handle my posted arrays" to "No" (I could never to get it to work or show the implode code in the autogenerated code)
IMPORTANT - I'm a newbie, wet behind the ears, so it's very likely that I'm missing something simple here. But... this is how I got it to work. Suggestions from the experts are certainly welcome. (Isn't the autogenerate code supposed to take care of the implode function to store the arrays in the db??)
Hi peasea,
FYI - OnSubmit Before code is never executed if Send Emails isn't turned on. So, as you've found, use OnSubmit After for preference.
Useful post, thanks.
Bob
FYI - OnSubmit Before code is never executed if Send Emails isn't turned on. So, as you've found, use OnSubmit After for preference.
Useful post, thanks.
Bob
(Isn't the autogenerate code supposed to take care of the implode function to store the arrays in the db??)
Hi, yes, I think there was a small bug at this piece, its fixed in the coming release!
Regards
Max
This topic is locked and no more replies can be posted.
