paulmason411
Posts: 127
|
| Posted: 10/20/2008, 1:48 AM |
|
Hi Guys,
I have a record with 2 fields. The first is a textbox field which the user can select using the date picker, the second is a hidden field that adds 2 weeks to what ever date was chosen by the user. The record should be able to insert and update, each time changing the hidden date to +2 weeks of the first date.
An example of my problem is:
Invoice created: [textbox]
Invoice due: [hidden]
[submit]
So the date due should always be +2 weeks to the date created.
Any Ideas? I'm sure someone must have done something similar to this before.
_________________
http://paulmason.name - Web Development Blog
|
 |
 |
andy
Posts: 183
|
| Posted: 10/21/2008, 6:08 AM |
|
You can do it with javascript using an onchange event for the Invoice created field.
OR
You can use the CCDateAdd function.
If you create custom code for the form's After Update event and then do something along the lines of the following:
global $formname;
$formname->InvoiceDueField->SetValue(CCDateAdd($formname->InvoiceCreatedField->GetValue(), "+2week") );
Change $formname to the name of the form
Change field names to their correct names !
Search for "CCDateAdd" in other posts to see other examples.
Good luck.
_________________
Andy
RAD tools for rich UI controls:
http://www.koolphptools.com |
 |
 |
paulmason411
Posts: 127
|
| Posted: 10/21/2008, 7:34 AM |
|
Thanks Andy, that was just what I was after.
The weird thing is that i searched in the codecharge help file with the keyword 'date' and it didn't return that function. The weirder thing is I just searched for 'CCDateAdd' in the help file and it returned no results. Does anyone know if it has been documented else where? For future reference I would like to browse a list of all the date functions. Any ideas?
_________________
http://paulmason.name - Web Development Blog
|
 |
 |
andy
Posts: 183
|
| Posted: 10/21/2008, 7:52 AM |
|
It's not documented in the Help file (not sure why not as it's a really useful function)
Use the Search form from the menu (rather than topic: search box)
Select php forums and others if you want and then
search for "CCDateAdd"
You should get some results
This is the search url:
http://forums.codecharge.com/search.php?s_keyword=CCDat...[]=35&s_period=
_________________
Andy
RAD tools for rich UI controls:
http://www.koolphptools.com |
 |
 |
paulmason411
Posts: 127
|
| Posted: 10/21/2008, 8:30 AM |
|
Cheers.
In that link you sent I noticed mention of a codecharge wiki. It was planned to put all that sort of documentation in it. Has this been created yet?
When I googled I found this: http://codechargewiki.com/doku.php
however it looked empty
_________________
http://paulmason.name - Web Development Blog
|
 |
 |