Is it just me or is using javascript in CakePHP impossible. Here is
what I'm trying to do and I will be a detailed as I can.
I have coded in php before and I have used some javascript to produce
a Calendar widget on the screen when a user clicks on a image (a mini
calendar image). Here is a snippet of that code (this would be in
HTML)
<SCRIPT src="cal2.js" type='text/javascript'></SCRIPT>
<SCRIPT Language="JavaScript">
//Define calendar(s): addCalendar ("Unique Calendar
Name", "Window title", "Form element's name", Form name")
addCalendar("Calendar1", "Select Date", "shipDate",
"BackOrderCreateForm");
setFormat("yyyymmdd");
setSize(200, 200, -200, -200);
addCalendar("startDate", "Select Start Date",
"startDate", "itemSoldVendoReport");
addCalendar("endDate", "Select End Date", "endDate",
"itemSoldVendoReport");
</SCRIPT>
.....
then further along in the file I do the following.....
Please enter a start date: (yyyymmdd) <input type='text'
id='startDate' size='8' name='startDate' value='<? print getStartDate
(); ?>'> <a href="javascript:showCal('startDate')"><IMG
SRC="calendar.gif" BORDER="0"></a>
Now, I have followed the SCARCE DOCUMENTATION ON JAVASCRIPT HELPER in
the CakePHP documentation with NO SUCCESS. (documentation for cakephp
sucks the big one).
So here is my question, how do I use this cal2.js file to produce a
visual calendar on clicking a calendar image, then returning the
correct value to populate a value before a html post?
So far I have something like this..... this is in MY HTML VIEW
<? echo $javascript->link("cal2.js");?>
<? echo $javascript->codeblock("
setFormat('yyyymmdd');
setSize(200, 200, -200, -200);
addCalendar('RYAN', 'Select Start Date', 'selected_start_date',
'StoredFileIndexForm');
",false);
?>
.......
then I have further along in that view.....
echo $html->image('calendar.gif');
echo $javascript->codeblock("showCal('RYAN');");
Please let me know if anyone can help on this. NO I'm not going to
write and overbearing controller for something in normal html i had
working with 7 lines of code. Plus most of the documentation out
there is dealing with Ajax, no straight on javascript.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment