CalendarXP.net Support Forum Index CalendarXP.net Support
Most forums here are private and invisible to public.
 
 FAQFAQ   SearchSearch   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

populate 3 dropdown boxes

 
Post new topic   Reply to topic    CalendarXP.net Support Forum Index -> PopCalendarXP Related
View previous topic :: View next topic  
Author Message
mdesign04



Joined: 15 May 2007
Posts: 11

PostPosted: Wed May 16, 2007 9:13 am    Post subject: populate 3 dropdown boxes Reply with quote

Hi I am somehow trying to get the example on this page http://www.calendarxp.net/tt_pop.shtml to work. Under Variety PopCalendarXP Demos, the example with the 3 dropdown menus. This works different as the one on the classic demo example.

Here the part of the code I have so far:

Code:

<form name="datesearch" method="post" action="bydate.php">

<td width="24%"><?php
            // Get current Date for the default opening search
            if ($formbydate != '1')
            {
               $TodayDay = date("j");
               $TodayMonth = date("n");
               $TodayYear = date("Y");
            }
         ?><select name="searchDate_bymonth" class="selectionDatebox" onBlur="bydatemethod1()" onchange="if(self.gfPop)gfPop.updateHidden(this)">
                  <OPTION value="1" <?php if ($TodayMonth == '1' || $bymonth == '1') { echo  "selected"; } ?>>January</OPTION>
                  <OPTION value="2" <?php if ($TodayMonth == '2' || $bymonth == '2') { echo  "selected"; } ?>>February</OPTION>
                  <OPTION value="3" <?php if ($TodayMonth == '3' || $bymonth == '3') { echo  "selected"; } ?>>March</OPTION>
                  <OPTION value="4" <?php if ($TodayMonth == '4' || $bymonth == '4') { echo  "selected"; } ?>>April</OPTION>
                  <OPTION value="5" <?php if ($TodayMonth == '5' || $bymonth == '5') { echo  "selected"; } ?>>May</OPTION>
                  <OPTION value="6" <?php if ($TodayMonth == '6' || $bymonth == '6') { echo  "selected"; } ?>>June</OPTION>
                  <OPTION value="7" <?php if ($TodayMonth == '7' || $bymonth == '7') { echo  "selected"; } ?>>July</OPTION>
                  <OPTION value="8" <?php if ($TodayMonth == '8' || $bymonth == '8') { echo  "selected"; } ?>>August</OPTION>
                  <OPTION value="9" <?php if ($TodayMonth == '9' || $bymonth == '9') { echo  "selected"; } ?>>September</OPTION>
                  <OPTION value="10" <?php if ($TodayMonth == '10' || $bymonth == '10') { echo  "selected"; } ?>>October</OPTION>
                  <OPTION value="11" <?php if ($TodayMonth == '11' || $bymonth == '11') { echo  "selected"; } ?>>November</OPTION>
                  <OPTION value="12" <?php if ($TodayMonth == '12' || $bymonth == '12') { echo  "selected"; } ?>>December</OPTION>
                </select></td>
<td width="11%"><select name="searchDate_byday" class="selectionDatebox" onBlur="bydatemethod1()" onchange="if(self.gfPop)gfPop.updateHidden(this)">
<?php
 for ($i = 1; $i <= '31'; $i++)
 {
    echo "<OPTION value=\"$i\"";
if ($i == $TodayDay || $i == $byday) { echo "selected"; }
  echo ">$i</OPTION>";
</select>
</td>
<td width="18%"><select name="searchDate_byyear" class="selectionDatebox" onBlur="bydatemethod1()" onchange="if(self.gfPop)gfPop.updateHidden(this)"><?php
for ($i = 2007; $i <= '2012'; $i++)
{
   echo "<OPTION value=\"$i\"";
if ($i == $TodayYear || $i == $byyear) { echo "selected"; }
 echo ">$i</OPTION>";
 }
 ?></select>
</td>

And here the Calender trigger link

<td width="42%"><span class="popcal"><img src="images/calendar/cal.gif" width="16" height="16" border="0" align="absmiddle" onclick="if(this.blur)this.blur();var fm=document.datesearch;if(self.gfPop)gfPop.fPopCalendar(fm.searchDate,fm.searchDate_bymonth,fm.searchDate_byday,fm.SearchDate_byyear);" onmouseover="this.style.cursor='hand'; return;" href="javascript:void(0)"></span><input name="searchDate" type="hidden" value=""></td>


The iframe:
Code:

<iframe width=178 height=183 name="gToday:normal:agenda.js" id="gToday:normal:agenda.js"
src="calendar/ipopeng.htm" scrolling="no" frameborder="0"
style="visibility:visible; z-index:999; position:absolute; top:-500px;">
<LAYER name="gToday:normal:agenda.js" src="calendar/npopeng.htm:agenda.js" background="calendar/npopeng.htm"></LAYER>
</iframe>


And the plugin.js contains:
Code:

function updateHidden(dc) {
  var prefix=dc.name.split("_")[0];
  var els=dc.form.elements;
  els[prefix].value=fFormatInput(els[prefix+"_byyear"].options[els[prefix+"_byyear"].selectedIndex].value,els[prefix+"_bymonth"].options[els[prefix+"_bymonth"].selectedIndex].value,els[prefix+"_byday"].options[els[prefix+"_byday"].selectedIndex].value);
}
function fAfterSelected(y,m,d,e) {
   var prefix=gdCtrl.name;
   var formRef=gdCtrl.form;
   formRef.elements[prefix+"_byday"].options.selectedIndex=d;
   formRef.elements[prefix+"_bymonth"].options.selectedIndex=m;
   var _yc=formRef.elements[prefix+"_byyear"];
   _yc.options.selectedIndex=y-_yc.options[1].value+1;
}


What I am doing wrong? I get the error message:
Code:
gcbYear.options.0.value is null or not an object
refering to the ipopeng.htm file
Back to top
View user's profile Send private message
calendarxp
Site Admin


Joined: 30 Jan 2005
Posts: 409

PostPosted: Wed May 16, 2007 12:54 pm    Post subject: Reply with quote

Could you please use Firefox to view the same page and telling us the error message in the "tools/error console"?

The error message in IE is not accurate.

_________________
Copyright 2003-2011 Idemfactor Solutions, Inc. All rights reserved.
Back to top
View user's profile Send private message
mdesign04



Joined: 15 May 2007
Posts: 11

PostPosted: Wed May 16, 2007 5:58 pm    Post subject: Reply with quote

I just now open it in Firefox, the trigger doesn't work there. After clicking it doesn't do nothing and I also don't get a error message.
Back to top
View user's profile Send private message
calendarxp
Site Admin


Joined: 30 Jan 2005
Posts: 409

PostPosted: Wed May 16, 2007 10:49 pm    Post subject: Reply with quote

Could you please provide us a link to test?
_________________
Copyright 2003-2011 Idemfactor Solutions, Inc. All rights reserved.
Back to top
View user's profile Send private message
mdesign04



Joined: 15 May 2007
Posts: 11

PostPosted: Thu May 17, 2007 7:41 am    Post subject: Reply with quote

Hi,
I sent you the link in a private message as the site is not public yet and you have to login.
Back to top
View user's profile Send private message
calendarxp
Site Admin


Joined: 30 Jan 2005
Posts: 409

PostPosted: Thu May 17, 2007 1:01 pm    Post subject: Reply with quote

Please add the following code to the end of your plugins.js:
Code:
function fPopCombo(dayc,monc,yearc,dc) {
  _dc=dayc; _mc=monc; _yc=yearc;
  dc.value=fFormatInput(_yc.value,_mc.value,_dc.value);
  fPopCalendar(dc, null, null, yearc);
}

Then change the onclick event of your button tag to:
Code:
onclick="if(this.blur)this.blur();var fm=document.datesearch;if(self.gfPop)gfPop.fPopCalendar(fm.searchDate_byday,fm.searchDate_bymonth,fm.SearchDate_byyear,fm.searchDate);"

_________________
Copyright 2003-2011 Idemfactor Solutions, Inc. All rights reserved.
Back to top
View user's profile Send private message
mdesign04



Joined: 15 May 2007
Posts: 11

PostPosted: Thu May 17, 2007 6:37 pm    Post subject: Reply with quote

it is still doing the same.

I notice that the function bellow has fPopCalender, should it not be fPopCombo as function? I tried it and get a different error message then. so I put it back to have the code you supported.

_yc.value is not or not an object.

Code:

onclick="if(this.blur)this.blur();var fm=document.datesearch;if(self.gfPop)gfPop.fPopCalendar(fm.searchDate_byday,fm.searchDate_bymonth,fm.SearchDate_byyear,fm.searchDate);"


sorry for the inconvenience, but still nothing on both browsers and I don't see right now why it is not doing it. Everything seems to be fine.[/code]
Back to top
View user's profile Send private message
calendarxp
Site Admin


Joined: 30 Jan 2005
Posts: 409

PostPosted: Fri May 18, 2007 2:06 am    Post subject: Reply with quote

Sorry, my mistake - you're right, fPopCombo() should be used in place of fPopCalendar():

Code:
onclick="if(this.blur)this.blur();var fm=document.datesearch;if(self.gfPop)gfPop.fPopCombo(fm.searchDate_byday,fm.searchDate_bymonth,fm.SearchDate_byyear,fm.searchDate);"

_________________
Copyright 2003-2011 Idemfactor Solutions, Inc. All rights reserved.
Back to top
View user's profile Send private message
mdesign04



Joined: 15 May 2007
Posts: 11

PostPosted: Fri May 18, 2007 6:50 am    Post subject: Reply with quote

ok changed it then I get this error in IE,

_yc.value is not or not an object.

like I wrote in my last post. I figured that out, the searchDate_byyear had a capital S at the beginning like SearchDate_byyear, after changing this it works almost, the calendar pops up, I am abble to pick a date and the dropdowns change.

Only one error left, if I click for instance 22th May 2007 or any other date, it adds always + 1 month, so that the dropdown change to 22th June 2007.
Then you pick a different date and it adds another month to it. So 23rd July 2007.
Back to top
View user's profile Send private message
mdesign04



Joined: 15 May 2007
Posts: 11

PostPosted: Fri May 18, 2007 11:56 am    Post subject: Reply with quote

Hi,

I got it finally to work,

I saw now the problem myself. first at all the hidden value text field needs a dummy date to populate the calendar back as this was also not working, so I entered here a dummy date and this was working.

the problem with the calendar was due to the dropdown boxws, the month and day box didn't have a 0 value, they started with 1-31 and 1-12. After adding here a 0 value at the beginning, the problem was gone.

Many thanks to pointing me on the right direction to solve the problem.
Back to top
View user's profile Send private message
calendarxp
Site Admin


Joined: 30 Jan 2005
Posts: 409

PostPosted: Fri May 18, 2007 12:36 pm    Post subject: Reply with quote

Actually, you may modify the fAfterSelected() if you don't want to use a 0 value in options. e.g.
Code:

function fAfterSelected(y,m,d,e) {
   var prefix=gdCtrl.name, formRef=gdCtrl.form;
   var _yc=formRef.elements[prefix+"_year"], _mc=formRef.elements[prefix+"_mon"], _dc=formRef.elements[prefix+"_day"];
   _dc.options.selectedIndex=d-_dc.options[1].value+1;
   _mc.options.selectedIndex=m-_mc.options[1].value+1;
   _yc.options.selectedIndex=y-_yc.options[1].value+1;
}

Anyway, good to know you get it working.

_________________
Copyright 2003-2011 Idemfactor Solutions, Inc. All rights reserved.
Back to top
View user's profile Send private message
mdesign04



Joined: 15 May 2007
Posts: 11

PostPosted: Fri May 18, 2007 4:58 pm    Post subject: Reply with quote

Sounds good as I don't necessary need the null values.

Thank you very much for all.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    CalendarXP.net Support Forum Index -> PopCalendarXP Related All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum


Copyright 2003- Idemfactor Solutions, Inc. All rights reserved.
Powered by phpBB © 2001, 2005 phpBB Group