The date-field in the database has a format like 2010/08/01. In my form I get a calender and I can choose a date, then the field looks like 01/08/2010 and the result is not saved in the database. What could be wrong?
Forums
date doesn't save to database
Hi pokemon,
You can change the datefield format to Y-m-d in the Date Format box on the Form General tab. Or you can add PHP in the OnSubmit Before box to convert from one format to the other.
Bob
You can change the datefield format to Y-m-d in the Date Format box on the Form General tab. Or you can add PHP in the OnSubmit Before box to convert from one format to the other.
Bob
I changed the datefield format to Y-m-d in the Date Format box on the Form General tab. I didn't get the calender to open.
I changed the datefield format to Y/m/d, it still doesn't get saved into the database.
Could you help me with the code to convert it to the right format?
I changed the datefield format to Y/m/d, it still doesn't get saved into the database.
Could you help me with the code to convert it to the right format?
I have filled in Y-m-d in date format. If I fill a date by the phpMyadmin and then open this record on my website, I get this date. But I cannot change it (read as 'changes aren't saved).
If I open a record where the date is not yet filled (0000-00-00) I can't open the datebox.
If I open a record where the date is not yet filled (0000-00-00) I can't open the datebox.
Hi pokemon,
If you use different date formats for the datepicker and the database table (and most of the time you do) then you need code to switch between them.
If you have Y-m-d as the datepicker input format then all dates should work OK apart from the empty ones. These will show as '0000-00-00' in the database but need to be '' for the date-picker.
You can sort this with a PHP snippet in the Form HTML.
Bob
Is it normal, I can't manually type a date and the field is grey?
Yes, tha's normal if you use a datepicker field.If you use different date formats for the datepicker and the database table (and most of the time you do) then you need code to switch between them.
If you have Y-m-d as the datepicker input format then all dates should work OK apart from the empty ones. These will show as '0000-00-00' in the database but need to be '' for the date-picker.
You can sort this with a PHP snippet in the Form HTML.
<?php
if ( !$mainframe->isSite() ) { return; }
$date = ??? // this line depends on your form
if ( $date == '0000-00-00' ) {
$date = '';
}
?>
Bob
Thanks for your answer, but now I get a blanc page.
The name of the field in the database is Datum. I changed the code as follows:
I put the code in the middle of the form code, is this the right place?
The name of the field in the database is Datum. I changed the code as follows:
<?php
if ( !$mainframe->isSite() ) { return; }
$date = Datum // this line depends on your form
if ( $date == '0000-00-00' ) {
$date = '';
}
?>
I put the code in the middle of the form code, is this the right place?
Hi pokemon,
It's the right place for the code but this line won't do anything:
Bob
It's the right place for the code but this line won't do anything:
$date = Datum
You need to have good PHP in there - presumably the code to get the value from the database. It depends on how the rest of your form is working.Bob
Hi,
First of all: i love Chronoforms! I recently made a new form and I decided to use the 'save data to database'-option as a reassurance. Good idea, since I messed up the mail to-fields, so all my filled in-forms were gone.
But...I don't quite understand this database-thing. I chose a jos_contacts-table I think and thought that Chronoforms would just dump the form input there. But now I can't find any one of those 'lost' forms, because, of course there is nu relation to the inputfields on my form and the fields of the database.
So I've got two questions
1. How, if at all, can I retrieve the form data from the jos_contacts-table?
2. Since I am clearly clueless about the way Chronoforms and MySql can be combined, where could I find more info on, creating or editing tables to backup my form data savely?
Thank you for any suggestions,
egs
First of all: i love Chronoforms! I recently made a new form and I decided to use the 'save data to database'-option as a reassurance. Good idea, since I messed up the mail to-fields, so all my filled in-forms were gone.
But...I don't quite understand this database-thing. I chose a jos_contacts-table I think and thought that Chronoforms would just dump the form input there. But now I can't find any one of those 'lost' forms, because, of course there is nu relation to the inputfields on my form and the fields of the database.
So I've got two questions
1. How, if at all, can I retrieve the form data from the jos_contacts-table?
2. Since I am clearly clueless about the way Chronoforms and MySql can be combined, where could I find more info on, creating or editing tables to backup my form data savely?
Thank you for any suggestions,
egs
Hi egs,
Please check the Database Tutorial from the Tutorials link above.
Bob
Please check the Database Tutorial from the Tutorials link above.
Bob
:D
Bob
It works with this code. Thanks Greyhead for all your help.
For the Fresh Boarders like me:
I found some explaination for getVar here http://docs.joomla.org/Retrieving_data_from_GET_and_POST_requests
I used VARCHAR type for my datefield.
Hi pokemon,
It's the right place for the code but this line won't do anything:
$date = Datum
You need to hav good PHP in there - presumably the code to get the value from the database. It depends on how the rest of your form is working.Bob
It works with this code. Thanks Greyhead for all your help.
<?php
if ( !$mainframe->isSite() ) { return; }
$date = JRequest::getVar('datefieldname'); // this line depends on your form
if ( $date == '0000-00-00' ) {
$date = '';
}
?>
For the Fresh Boarders like me:
I found some explaination for getVar here http://docs.joomla.org/Retrieving_data_from_GET_and_POST_requests
I used VARCHAR type for my datefield.
:(
I still have a problem, saving the data : (not only the datefield but ) all fields I added manually (not with the wizard)
Those fields are not in the autogenerated code tab.
How can I get them there?
I still have a problem, saving the data : (not only the datefield but ) all fields I added manually (not with the wizard)
Those fields are not in the autogenerated code tab.
How can I get them there?
I found this lead:
http://www.chronoengine.com/forums.html?cont=posts&f=2&t=11793&p=23875
And I changed the Run Order tab so that OnSubmit After runs after the Autogenerated Code. This doesn't have any effect.
http://www.chronoengine.com/forums.html?cont=posts&f=2&t=11793&p=23875
Re: Auto Generated Field gets lost after Update
Postby GreyHead ยป Wed Feb 18, 2009 9:31 am
Hi Tejas,
From ChronoForms v3.0 on you can't edit the Autogenerated Code (or rather if you do then ChronoForms over-writes it).
You can still execute code in a similar way in the OnSubmit After code box. If you need it to execute after the AutoGenerated code (because you need the record id for example) then change the settings in the Run Order tab so that OnSubmit After rund after the Autogenerated Code.
Bob
And I changed the Run Order tab so that OnSubmit After runs after the Autogenerated Code. This doesn't have any effect.
Hi pokemon,
You need to refresh the DB Connection after any changes to database column names. In the Form Editor click the DB Connection tab and set the Connection to 'No'. Click the 'Apply icon in the toolbar to save the form, open the DB Connection tab, set the Connection back to 'Yes' and re-save the form. This will refresh the copy of the table information that ChronoForms uses.
Bob
You need to refresh the DB Connection after any changes to database column names. In the Form Editor click the DB Connection tab and set the Connection to 'No'. Click the 'Apply icon in the toolbar to save the form, open the DB Connection tab, set the Connection back to 'Yes' and re-save the form. This will refresh the copy of the table information that ChronoForms uses.
Bob
Thanks for you advise. I had to make a new DBtable because I have extra fields in this form that I don't use yet in the first form to fill the DBtable.
I reconnected the table, put the connection on 'yes'.
If I trie to change (with chronoconnectivity edit) a record I saved with the first form, I don't see the data in my fields (the data was saved).
If I open the form from the backend of chronoconnectivity, I see the data.
Do you have an idea where I have to look for solving this?
I reconnected the table, put the connection on 'yes'.
If I trie to change (with chronoconnectivity edit) a record I saved with the first form, I don't see the data in my fields (the data was saved).
If I open the form from the backend of chronoconnectivity, I see the data.
Do you have an idea where I have to look for solving this?
Hi pokemon,
It sounds like the DB Connection needs refreshing to get ChronoForms to recognise all the table fields. I'm not clear if you've done this or not.
I don't use the ChronoConnectivity 'edit record' tags so I'm not sure exactly how they work.
Bob
It sounds like the DB Connection needs refreshing to get ChronoForms to recognise all the table fields. I'm not clear if you've done this or not.
I don't use the ChronoConnectivity 'edit record' tags so I'm not sure exactly how they work.
Bob
I solved the problem.
I copied all the code of the other form into this form but this included some php to count a sum.
I copied all the code of the other form into this form but this included some php to count a sum.
As I mentioned before, I had to make a new table. This I did with the option of chronoforms based on my form. Unfurtunately, some fields seem not to be recognized. I manually added those in the table an followed your advice of above. The table information is not refreshed.
I updated my joomla.
And I made the form all over again trying not to forget any field. Of course I forgot 1. I set the database to no and erased all fields in the auto-generated tab, put database on yes again. And, yes the forgotten field was found.
Finally,I can get further in my development.
And I made the form all over again trying not to forget any field. Of course I forgot 1. I set the database to no and erased all fields in the auto-generated tab, put database on yes again. And, yes the forgotten field was found.
Finally,I can get further in my development.
This topic is locked and no more replies can be posted.