saseow
Posts: 744
|
| Posted: 03/08/2009, 3:19 AM |
|
I am having a really difficult time with this:
I have four fields on a record form: a list box (connected to a project table) a start_date, end_date and notes field. When a project is selected with the listbox the other three fields should be autofilled from the project table.
The notes works perfectly but no matter what kind of formatting I do for the dates, these boxes do not autofill.
I have tried changing them to text types, various formatting including the DB date format and nothing seems to work.
Is there special formatting required with javascript to get a MySQL date to be recognised and used?
|
 |
 |
datadoit
|
| Posted: 03/08/2009, 6:51 AM |
|
This will be a bugar for you. I'd suggest to help get you along, go
look at the popup date picker code that CCS uses to see how they're
handling it.
|
|
|
 |
datadoit
|
| Posted: 03/08/2009, 7:29 AM |
|
Don't get too discouraged Trevor. As you gain more experience, you'll
learn to appreciate why computers handle dates the way they do.
In simplest terms, your data form is showing textual representations of
the date, but the database wants a julian representation of the date (an
integer). CCS tries to handle this conversion as much as possible
without coding, but there are times we you need to get down and dirty
and do it yourself.
To make you feel better, if you didn't have CCS to handle much of this
legwork, you'd literally spend hours handling dates manually.
Just browse through your Common file to see all of the 'date' work that
CCS does for you.
|
|
|
 |
saseow
Posts: 744
|
| Posted: 03/08/2009, 8:06 AM |
|
Thanks datadoit,
I have decided that it is too much hassle. I will leave this open as someone may have a solution.
I am going another route with two varchar fields in the table that mimic the two date fields. The autofill works perfectly with a varchar but with a date ........?
Cheers for now,
Trevor
|
 |
 |
joejac
Posts: 242
|
| Posted: 05/06/2009, 4:32 PM |
|
Hello Trevor,
I see that you were able to run the Autofill on a listbox.
I also have a listbox and I need the autofill to populate 2 fields more one numeric: estimate number and other that originally was a list box: distributor name
Will you be so kind to post your successful procedure, I use PHP/MySQL
Thanks a lot
best regards
joejac
|
 |
 |
saseow
Posts: 744
|
| Posted: 05/07/2009, 4:11 AM |
|
Hi joejac,
I crooked this entire thing as I could not get it to work with Ajax. On my list box I have client side On Change cutom code:
window.location = "set_job_id.php?caller=5&job_id="+document.getElementById('work_detailproject_id').value;
The set_job_id.php is simply a blank page with a redirect back:
//Set the job Id
global $Redirect;
$caller=CCGetParam("caller");
switch ($caller){
case "1":
$Redirect = "job_inspections_edit.php?global_job=".CCGetParam("job_id");;
break;
case "2":
$Redirect = "critical_path_full_edit.php?global_job=".CCGetParam("job_id");;
break;
case "3":
$Redirect = "employees_on_site_edit.php?global_job=".CCGetParam("job_id");;
break;
case "4":
$Redirect = "photo_upload.php?global_job=".CCGetParam("job_id");;
break;
case "5":
$Redirect = "work_detail_full_edit.php?global_job=".CCGetParam("job_id");;
break;
case "6":
$Redirect = "super_photo_upload.php?global_job=".CCGetParam("job_id");;
break;
}
Now that I have the ID for the particular job in the URL parameters, I can do all the code I want to fill all the fields I want in the before show event of the form with the list box. Certainly not ajax but it works and that is all I am really after.
Hope this gives you some ideas.
|
 |
 |
|