Forums

Some fields of form are not saving in DB

tidusx18 23 Feb, 2009
Hello,

I just started using Chrono Forms and Chrono Connectivity and so far both products are great! I have however hit a small problem...

I have a test form (Newform; attached) and am having a problem that some of the fields are not saving to the database. I checked the database tab and it is set to YES and the appropriate database is selected. Also, I created the table with the "create table" button in Chrono Forms. I can't seem to find anything wrong with the settings or the for code...

Any help is appreciated.

Thank you.

Daniel
tidusx18 23 Feb, 2009
Well it seems to have fixed it self...everything is working fine now...I don't know what was wrong before...๐Ÿ™„
GreyHead 23 Feb, 2009
Hi tidusx18,

I don't know, usually this happens because the fields weren't selected when the 'Create Table' command was used.

Bob
xrum 30 Mar, 2009
my fields are not saving either. i have deleted and recreated a database multiple times now, but they just come up blank.

i see the fields in the database, but they have no value (except for the ones that are auto generated by the "create table" like the id, and all that other good stuff

please help
Max_admin 30 Mar, 2009
Hi xrum,

did you submit any data ? do your fields have any spaces or - ? show me your form code and a screenshot for the table structure!

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
tidusx18 01 Apr, 2009
Hi max,

I am still having the problem with some fields not saving to the DB upon submission of the form in the front end, but now I realized that some fields aren't even being created when I select a form and hit the "create table" button on top.

Here is the form code for one of the forms I tried making a table for in my DB...attached is the screen shot of the mySQLadmin structure tab. I assume that's what you meant.

<div class="form_item">
  <div class="form_element cf_heading">
    <h1 class="cf_text">Email marketing quote request</h1>
  </div>
  <div class="clear">ย </div>
</div>

<div class="form_item" id='first name' style='display:block;' >
  <div class="form_element cf_textbox">
    <label class="cf_label">First name</label>
    <input class="cf_inputbox required" maxlength="150" size="30" id="text_0" name="First name" type="text" />
  
  </div>
  <div class="clear">ย </div>
</div>

<div class="form_item" id='last name' style='display:block;' >
  <div class="form_element cf_textbox">
    <label class="cf_label">Last name</label>
    <input class="cf_inputbox required" maxlength="150" size="30" id="text_1" name="Last name" type="text" />
  
  </div>
  <div class="clear">ย </div>
</div>

<div class="form_item" id='company name' style='display:block;' >
  <div class="form_element cf_textbox">
    <label class="cf_label">Company name</label>
    <input class="cf_inputbox" maxlength="150" size="30" id="text_2" name="Company name" type="text" />
  
  </div>
  <div class="clear">ย </div>
</div>

<div class="form_item" id='street address' style='display:block;' >
  <div class="form_element cf_textbox">
    <label class="cf_label">Street address</label>
    <input class="cf_inputbox" maxlength="150" size="30" id="text_5" name="Address" type="text" />
  
  </div>
  <div class="clear">ย </div>
</div>

<div class="form_item" id='city' style='display:block;' >
  <div class="form_element cf_textbox">
    <label class="cf_label">City</label>
    <input class="cf_inputbox required" maxlength="150" size="30" id="text_6" name="City" type="text" />
  
  </div>
  <div class="clear">ย </div>
</div>

<div class="form_item" id='state' style='display:block;' >
  <div class="form_element cf_textbox">
    <label class="cf_label">State</label>
    <input class="cf_inputbox required" maxlength="150" size="30" id="text_4" name="State" type="text" />
  
  </div>
  <div class="clear">ย </div>
</div>

<div class="form_item" id='zip code' style='display:block;' >
  <div class="form_element cf_textbox">
    <label class="cf_label">Zip code</label>
    <input class="cf_inputbox required" maxlength="150" size="30" id="text_7" name="Zip code" type="text" />
  
  </div>
  <div class="clear">ย </div>
</div>

<div class="form_item" id='phone' style='display:block;' >
  <div class="form_element cf_textbox">
    <label class="cf_label">Phone</label>
    <input class="cf_inputbox required" maxlength="150" size="30" id="text_9" name="Phone" type="text" />
  
  </div>
  <div class="clear">ย </div>
</div>

<div class="form_item" id='other phone' style='display:block;' >
  <div class="form_element cf_textbox">
    <label class="cf_label">Other phone</label>
    <input class="cf_inputbox" maxlength="150" size="30" id="text_10" name="Other phone" type="text" />
  
  </div>
  <div class="clear">ย </div>
</div>

<div class="form_item" id='fax' style='display:block;' >
  <div class="form_element cf_textbox">
    <label class="cf_label">Fax</label>
    <input class="cf_inputbox" maxlength="150" size="30" id="text_11" name="Fax" type="text" />
  
  </div>
  <div class="clear">ย </div>
</div>

<div class="form_item" id='email' style='display:block;' >
  <div class="form_element cf_textbox">
    <label class="cf_label">Email</label>
    <input class="cf_inputbox required validate-email" maxlength="150" size="30" id="text_8" name="Email" type="text" />
  
  </div>
  <div class="clear">ย </div>
</div>

<div class="form_item" id='preferred contact method' style='display:block;' >
  <div class="form_element cf_dropdown">
    <label class="cf_label">Preferred contact method</label>
    <select class="cf_inputbox validate-selection" id="select_12" size="1" {cf_multiple} name="Preferred contact method">
<option value="">Choose Option</option>
<option value="Phone">Phone</option>
<option value="Other phone">Other phone</option>
<option value="Fax">Fax</option>
<option value="Email">Email</option>

    </select>
    
  </div>
  <div class="clear">ย </div>
</div>

<div class="form_item">
  <div class="form_element cf_dropdown">
    <label class="cf_label">Type of mailing</label>
    <select class="cf_inputbox validate-selection" id="select_3" size="1" {cf_multiple} name="type of mailing">
    <option value="">Choose Option</option>
      <option value="Consumer">Consumer</option>
<option value="Commercial">Commercial</option>
<option value="Consumer and commercial">Consumer and commercial</option>

    </select>
    <a class="tooltiplink" onclick="return false;"><img height="16" border="0" width="16" class="tooltipimg" src="components/com_chronocontact/css/images/tooltip.png"/></a>
				<div class="tooltipdiv">Type of mailing :: Please select whether your email campaign will be sent to consumers, businesses or both.</div>
  </div>
  <div class="clear">ย </div>
</div>

<div class="form_item">
  <div class="form_element cf_dropdown">
    <label class="cf_label">Quantity of emails</label>
    <select class="cf_inputbox validate-selection" id="select_4" size="1" {cf_multiple} name="quantity of emails">
    <option value="">Choose Option</option>
      <option value="Less than 1000">Less than 1000</option>
<option value="2500">2500</option>
<option value="5000">5000</option>
<option value="10000">10000</option>
<option value="15000">15000</option>
<option value="20000">20000</option>
<option value="25000">25000</option>
<option value="30000">30000</option>
<option value="35000">35000</option>
<option value="40000">40000</option>
<option value="45000">45000</option>
<option value="50000">50000</option>
<option value="100000">100000</option>
<option value="150000">150000</option>
<option value="175000">175000</option>
<option value="200000">200000</option>
<option value="250000">250000</option>
<option value="500000">500000</option>
<option value="More than 500000">More than 500000</option>

    </select>
    <a class="tooltiplink" onclick="return false;"><img height="16" border="0" width="16" class="tooltipimg" src="components/com_chronocontact/css/images/tooltip.png"/></a>
				<div class="tooltipdiv">Quantity of emails :: Please select the amount of emails you would like to send per mailing.</div>
  </div>
  <div class="clear">ย </div>
</div>

<div class="form_item">
  <div class="form_element cf_dropdown">
    <label class="cf_label">Frequency</label>
    <select class="cf_inputbox validate-selection" id="select_5" size="1" {cf_multiple} name="frequency">
    <option value="">Choose Option</option>
      <option value="One time only">One time only</option>
<option value="Weekly">Weekly</option>
<option value="Bi-weekly">Bi-weekly</option>
<option value="Monthly">Monthly</option>
<option value="Bi-monthly">Bi-monthly</option>
<option value="Quarterly">Quarterly</option>
<option value="Bi-annually">Bi-annually</option>
<option value="Annually">Annually</option>
<option value="Other specify in comments">Other specify in comments</option>

    </select>
    <a class="tooltiplink" onclick="return false;"><img height="16" border="0" width="16" class="tooltipimg" src="components/com_chronocontact/css/images/tooltip.png"/></a>
				<div class="tooltipdiv">Frequency :: Please select how often you expect to send your emails.</div>
  </div>
  <div class="clear">ย </div>
</div>

<div class="form_item">
  <div class="form_element cf_dropdown">
    <label class="cf_label">Start email campaign within</label>
    <select class="cf_inputbox validate-selection" id="select_6" size="1" {cf_multiple} name="start when">
    <option value="">Choose Option</option>
      <option value="ASAP!">ASAP!</option>
<option value="1 week">1 week</option>
<option value="2 weeks">2 weeks</option>
<option value="3 weeks">3 weeks</option>
<option value="1 month">1 month</option>
<option value="2 months">2 months</option>
<option value="Uknown">Uknown</option>

    </select>
    <a class="tooltiplink" onclick="return false;"><img height="16" border="0" width="16" class="tooltipimg" src="components/com_chronocontact/css/images/tooltip.png"/></a>
				<div class="tooltipdiv">Start email campaign within :: Please select how soon you expect to begin your email campaign.</div>
  </div>
  <div class="clear">ย </div>
</div>

<div class="form_item">
  <div class="form_element cf_textarea">
    <label class="cf_label">Geographic target area(s)</label>
    <textarea class="cf_inputbox required" rows="3" id="text_10" cols="30" name="geo target"></textarea>
    <a class="tooltiplink" onclick="return false;"><img height="16" border="0" width="16" class="tooltipimg" src="components/com_chronocontact/css/images/tooltip.png"/></a>
				<div class="tooltipdiv">Geographic target area(s) :: Please list any states, cities, counties or zip codes that you would like to target for your campaign. Type, none, for national campaigns. Seperate each geographic area by a comma.</div>
  </div>
  <div class="clear">ย </div>
</div>

<div class="form_item">
  <div class="form_element cf_textarea">
    <label class="cf_label">Target demographics</label>
    <textarea class="cf_inputbox" rows="3" id="text_8" cols="30" name="demographics"></textarea>
    <a class="tooltiplink" onclick="return false;"><img height="16" border="0" width="16" class="tooltipimg" src="components/com_chronocontact/css/images/tooltip.png"/></a>
				<div class="tooltipdiv">Target demographics :: Please list any demographics that you would like to target. Seperate each demographic by a comma.</div>
  </div>
  <div class="clear">ย </div>
</div>

<div class="form_item">
  <div class="form_element cf_checkbox">
    <label class="cf_label">Additional services required</label>
    <div class="float_left">
      <input value="Email list" class="radio radio" id="Email_list" name="check0[]" type="checkbox" />
      <label for="Email_list" class="check_label">Email list</label>
      <br />
      
<input value="Email design" class="radio radio" id="Email_design" name="check0[]" type="checkbox" />
      <label for="Email_design" class="check_label">Email design</label>
      <br />
      
<input value="Database hosting" class="radio radio" id="Database_hosting" name="check0[]" type="checkbox" />
      <label for="Database_hosting" class="check_label">Database hosting</label>
      <br />
      
<input value="Data cleansing and/or appending" class="radio radio" id="Data_cleansing_and/or_appending" name="check0[]" type="checkbox" />
      <label for="Data_cleansing_and/or_appending" class="check_label">Data cleansing and/or appending</label>
      <br />
      
<input value="Other specify in comments" class="radio radio" id="Other_specify_in_comments" name="check0[]" type="checkbox" />
      <label for="Other_specify_in_comments" class="check_label">Other specify in comments</label>
      <br />
      

    </div>
    <a class="tooltiplink" onclick="return false;"><img height="16" border="0" width="16" class="tooltipimg" src="components/com_chronocontact/css/images/tooltip.png"/></a>
				<div class="tooltipdiv">Additional services required :: Please select any additional services required for your email campaign.</div>
  </div>
  <div class="clear">ย </div>
</div>

<div class="form_item">
  <div class="form_element cf_button">
    <input value="Submit" type="submit" />
  </div>
  <div class="clear">ย </div>
</div>
GreyHead 02 Apr, 2009
Hi tidusx18,

You have spaces in some of your fireld names, this is illegal in html and will cause problems. Please replace them with underscores e.g. 'First_name' and try again.
<input class="cf_inputbox required" maxlength="150" size="30" id="text_0" name="First name" type="text" />

Bob
tidusx18 02 Apr, 2009
OK, that fixed the problem and the data from each field gets saved in the DB except for one field. I put the code below. Since that field is a check box multi select should I give each check box a different name for it to save correctly? If so, does that also apply to a radio button selection field?

<div class="form_item">
  <div class="form_element cf_checkbox">
    <label class="cf_label">Additional services required</label>
    <div class="float_left">
      <input value="Email list" class="radio radio" id="Email_list" name="check0[]" type="checkbox" />
      <label for="Email_list" class="check_label">Email list</label>
      <br />
      
<input value="Email design" class="radio radio" id="Email_design" name="check0[]" type="checkbox" />
      <label for="Email_design" class="check_label">Email design</label>
      <br />
      
<input value="Database hosting" class="radio radio" id="Database_hosting" name="check0[]" type="checkbox" />
      <label for="Database_hosting" class="check_label">Database hosting</label>
      <br />
      
<input value="Data cleansing and/or appending" class="radio radio" id="Data_cleansing_and/or_appending" name="check0[]" type="checkbox" />
      <label for="Data_cleansing_and/or_appending" class="check_label">Data cleansing and/or appending</label>
      <br />
      
<input value="Other specify in comments" class="radio radio" id="Other_specify_in_comments" name="check0[]" type="checkbox" />
      <label for="Other_specify_in_comments" class="check_label">Other specify in comments</label>
      <br />
      

    </div>
    <a class="tooltiplink" onclick="return false;"><img height="16" border="0" width="16" class="tooltipimg" src="components/com_chronocontact/css/images/tooltip.png"/></a>
				<div class="tooltipdiv">Additional services required :: Please select any additional services required for your email campaign.</div>
  </div>
  <div class="clear">ย </div>
</div>


Daniel
GreyHead 02 Apr, 2009
Hi Daniel,

That code should work OK and save a list of the selected checkboxes to the database. There's one small problem with the / in the last id but I don't think that's stopping it saving.

Do you have "ChronoForms handle my posted arrays:" set to Yes at the bottom of the Autogenerated code tab?

Bob

PS Radio button groups only return one value so don't need array names; checkbox groups (and multiple selects) can return a list of several results so always need to be array names.
tidusx18 02 Apr, 2009
Bob,

"ChronoForms handle my posted arrays:" is set to YES, but that field is still not saving data to the DB. Could it be a setting for that specific field in the DB, like field type or something?

Ps: I attached a new PDF view of the DB structure again.

Daniel
GreyHead 02 Apr, 2009
Hi Daniel,

That looks OK. Please turn Debug on in the form General tab and copy and paste the output here when you submit the form.

Bob
tidusx18 02 Apr, 2009
Bob,

I am assuming this is what you meant. Please correct me if I'm wrong.

* Form passed first SPAM check OK
* Form passed the submissions limit (if enabled) OK
* Form passed the Image verification (if enabled) OK
* Form passed the server side validation (if enabled) OK
* Form passed the plugins step (if enabled) OK
* Debug End

_POST: Array ( [First_name] => Daniel [Last_name] => Victoriano [Company_name] => City Flyers, LLC [Address] => 1 [City] => Miami [State] => FL [Zip_code] => 33182 [Phone] => 305-609-6218 [Other_phone] => [Fax] => 305-221-1397 [Email] => [email]dvictoriano@bellsouth.net[/email] [Preferred_contact_method] => Other phone [type_of_mailing] => Consumer [quantity_of_emails] => 35000 [frequency] => Monthly [start_when] => 2 weeks [geo_target] => miami [demographics] => none [check0] => Array ( [0] => Email list ) [bc9b917a9e60468563927e04381d4a08] => 1 )
GreyHead 02 Apr, 2009
Hi Daniel,

Great, this bit [check0] => Array ( [0] => Email list ) shows that the checkbox info is being passed by the form back to ChronoForms.

Next step, please turn on DeBug for your site in Global Configuration | System; then submit the form again and at the bottom of the page you should see a long list of output. Look for something like INSERT INTO `jos_chronoforms_Email_marketing_form`. . . and copy that chunk of SQL here please. (You can turn Debug back off then.)

Bob
tidusx18 02 Apr, 2009
Would this be it?

#
INSERT INTO `jos_chronoforms_Email_marketing_form` ( `uid`,`recordtime`,`ipaddress`,`cf_user_id`,`First_name`,`Last_name`,`Company_name`,`Address`,`City`,`State`,`Zip_code`,`Phone`,`Other_phone`,`Fax`,`Email`,`Preferred_contact_method`,`type_of_mailing`,`quantity_of_emails`,`frequency`,`start_when`,`geo_target`,`demographics` )
VALUES ( 'IZWM1NDQ1NmNlNzRm','2009-04-02 - 17:46:21','72.153.172.32','65','Daniel','Victoriano','City Flyers, LLC','13347 NW 5 terr','Miami','FL','33182','305-609-6218','','305-221-1397','dvictoriano@bellsouth.net','Other phone','Commercial','5000','Bi-weekly','2 weeks','miami','none' )

That part is missing the check box field...hmm...I have no idea what that would mean lol.
Max_admin 03 Apr, 2009
Hi Daniel,

well, I'm trying to follow, where did you get this SQL statement exactly ? sorry but I have been very busy finishing the new release!

Cheers
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
tidusx18 03 Apr, 2009
No problem max...new releases are always good!๐Ÿ™‚

Bob asked me to do this..."Next step, please turn on DeBug for your site in Global Configuration | System; then submit the form again and at the bottom of the page you should see a long list of output. Look for something like INSERT INTO `jos_chronoforms_Email_marketing_form`. . . and copy that chunk of SQL here please. (You can turn Debug back off then.)"

I did that and that's what my last post was about. Let me know if any more info is needed.
Max_admin 03 Apr, 2009
good, no problems, its a very good idea!๐Ÿ™‚

it all looks fine but in your SQL I can't see a cf_id field, not sure if Joomla leaves it blank because its auto_increment, please check your table structure and see if this field is there ?

also please tell me Which Chronoforms version did you get from the site here!

Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
tidusx18 03 Apr, 2009
I'm using version 3.1 RC2 although I noticed that I have two instances of chrono contact 3.1 RC2 installed (or maybe just listed) in the installed components page.

I checked my DB structure and the cf_id field is there.
GreyHead 03 Apr, 2009
Hi tidusx18,

Sorry, just got back here this morning, as you noticed there is no check0 in the SQL which explains why it isn't writing to the database.

The problem is that as far as I recall ChronoForms uses Joomla code that calls the column list up from the database record and should use all the fields there apart from the unique key. I have no idea why check0 is no tbeing picked up.

[sendfb][/sendfb]
Bob
tidusx18 03 Apr, 2009
Hi Bob,

Here is the backup of the form...
GreyHead 03 Apr, 2009
Hi tidusx18,

I'm pretty certain that this is a bug in RC3 - it's handling the array values in the Email but not in the Autogenerated Code. Hopefully Max can fix this for RC4.

Bob

PS A small point, you have some code in the JavaScript box that actually belongs in the Form HTML - it uses some Joomla code to load the JavaScript in the page header. This is what shoudl go in the Form HTML complete with <?php . . . ?> tags
<?php
$doc =& JFactory::getDocument();
$script = "
window.addEvent('domready', function() {
  $('cbt0').addEvent('click', function(event) {
    if ( $('cbt0').checked === true ) {
      $('no_cbt').setStyle('display', 'block');
    }
  });
  $('cbt1').addEvent('click', function(event) {
    if ( $('cbt1').checked === true ) {
      $('no_cbt').setStyle('display', 'none');
    }
  });
});";
$doc->addScriptDeclaration( $script );
?>
tidusx18 03 Apr, 2009
Bob,

Is there any way to fix the bug temporarily...or should I just install the non-RC version? Also, the code you see there is from when you ans Max were helping me in creating the contingent form fields and at first I had though that code you gave me was Java๐Ÿ˜› lol. I must have forgotten to take it out.

Daniel.
GreyHead 03 Apr, 2009
Hi Daniel,

Here's a fix - put this code in the OnSubmit After box please:
<?php
$post =& JRequest::get('post');
if ( $paramsvalues->handlepostedarrays == 'Yes' ) {
  foreach ( $post as $k => $v ) {
    if ( is_array($post[$k]) ) {
      JRequest::setVar($k, implode(", ", $post[$k]), 'post');
    }
  }
}
?>

Bob

PS The code we gave you was JavaScript - but it has a PHP wrapper to get it to load in the page correctly
tidusx18 03 Apr, 2009
Thanks a lot...that worked! ๐Ÿ˜€

I'm guessing that same code will work for all my forms?

Now, I'm off to set up Chrono connectivity with this guide...http://www.chronoengine.com/forums.html?cont=posts&f=5&t=12324&p=21887&hilit=export+data+from+chrono+connectivity#p21887

I'll probably have more questions/problems so sorry in advance๐Ÿ˜› Though, I must say that you guys are by far the most supportive group I've come accross!!!

Max and Bob, Banzai!!! :mrgreen:

-Daniel-
newstuff 07 Apr, 2009
Thumbs up Bob - that worked for me too...... thanks for posting the details on the forums.

Thankyou once again, Bob, for an AMAZING product.....Legends.....
GreyHead 07 Apr, 2009
Hi newstuff,

Glad that you are enjoying it - Max's product though, I just do some technical support and fix the odd wrinkle or two.

Bob
newstuff 07 Apr, 2009
My apologies for not thanking Max - please pass on my thankyou's (i have purchased the product a little while back) - but I can see your legendary efforts here in the forums as well!

Such a GREAT program.
salmanshafiq 08 Apr, 2009
Hi!
I am having the same issue. Following is Posted Array.

_POST: Array ( [title] => Mr [first_name] => My First Name [last_name] => My Last Name [email_address] => me@domain.com [phone_number] => 44456654 [contact_method] => Array ( [0] => Email [1] => Phone ) [comments_enquiry] => these are comments [resume_file] => [hear_about_us] => Internet [submit_btn] => Submit Query [f38893f8e364290b78b4ede81896c16f] => 1 ) 


and here is the query chronoforms generates to save record in database.


INSERT INTO `pp_chronoforms_contact_us` ( `uid`,`recordtime`,`ipaddress`,`cf_user_id`,`title`,`first_name`,`last_name`,`email_address`,`phone_number`,`resume_file`,`hear_about_us`,`comments_enquiry` )
  VALUES ( 'IYmJmNTE0ZDE2YTU2','2009-04-08 - 13:15:03','192.168.1.3','0','Mr','My First Name','My Last Name','me@domain.com','44456654','','Internet','these are comments' )


Notice the only field which is missing from the query is "contact_method" which is a checkbox group. It is defined in form like this:
<input type="checkbox" name="contact_method[]"  value="Email" />
<br />
<input type="checkbox" name="contact_method[]"  value="Phone" />


I have been using chronoforms for quite a while now without a fuss, and if i remember correctly I have used this feature (handling posted arrays ) in an earlier version without an issue. I believe its something related to Version 3.0

PS: I am using Chronoforms 3.0 Stable on a Joomla 1.5.10 site. and chronoforms handles my psted arrays is set to Yes.

Thanks in Advance

EDIT: It is already solved while I was writing this reply. Cheers
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount
hostinger