Gossamer Forum
Home : Products : Links 2.0 : Customization :

New DatePicker mod for add mod forms

Quote Reply
New DatePicker mod for add mod forms
DatePicker Mod

Used if you have a specific field that you want to expire and not show after a certain date.

Use the expire field mod from GB Resources below.

http://cgi-resource.co.uk/pages/expirory.shtml

Add 2 new fields. Ones an info field and the other an expirory date field. define the info field further down in links.def as $db_info and the expirory as $db_expire. Make the expire field as not required, ie so in some cases there doesn't need to be an expirory date.
Then in nph-build.cgi go to the sub build_update_newpop:
Above
# Check to see if the record is new...
Add:
if ($values[$db_expire]){
$dates = &compare_dates($values[$db_expire], $date);
if ($dates){
$values[$db_info] = "";
print "\tUpdating record: $id, deleting extra info as it has expired.\n";
}
}

The expires field date needs to be in the same format as the Date field. ie like: 23-Jun-2001.


Now the DatePicker java script mod from TengYong Ng.

All files are attached:

Read the readme file:

Take the attached datepicker.js file and upload it to any non password protected directory you wish.

Upload the cal.gif to your image directory.

Put this between <head> </head> on add, modify and error pages where you want to use the date picker.

<script language="javascript" type="text/javascript" src="url to /datetimepicker.js"></script>

Then add the expire date field to your forms. Something like this:

<input type="text" name="ExpDate" id="ExpDate" size="15"><a href="javascript:NewCal('ExpDate','ddMMMyyyy')"><img src="http://yourDomain.com/images/cal.gif" width="16" height="16" border="0" alt="Pick a date"></a>

I would love to add it to the administrative forms, but lack the perl experience. Can anyone help me out with this?

Jake

Last edited by:

awwa: Feb 1, 2004, 1:52 PM