HTML Form with JS cal pop up on PHP rendered page -
08-31-2009
, 04:57 PM
I am using php to render a HTML form to edit some MySQL results.
I want to be able to select a date from a calendar, so I found a nice
calendar pop up JavaScript.
Problem I am having is that the results from the query and thus to be
modified by the form can generate some long pages, ie: one results set
right now is 282 records. Paging is not an option, as the user(s) do NOT
want it spread over multiple pages.
These leads to the calendar always being shown at the very TOP of the page.
So if your at the 282th record, you would have to scroll all the way back
to the top. The problem is that the JavaScript always thinks its at the
time top of the page.
I passing a count and then using a formula to move things down, and to a
point it works, but not as reliable as I would like.
Is there some better way to get the x,y location of where the field has been
drawn on the page/screen.
l = dest.offsetLeft + dest.offsetParent.offsetLeft;
t = dest.offsetTop - 125;
I've played with t = to use a formula based on the number of the record like
t = (90*loc) -125; etc.... This after trial and error works to a point but
can still place the cal off the screen and require a scroll to find.
Is there a better way to get a RELIABLE x,y location to popup the calendar
when the screen is drawn via php loop.
The php loop that renders the form:
for($i=0; $i<$number; $i++)
Â* Â* Â* Â* Â* Â* Â* Â* { Â* Â* Â*
Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* echo "<TR>\n";
Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* echo "\t<TD><input type=\"text\"
name=\"inspReqID$i\"
VALUE=\"$InspID[$i]\" size=\"8\" readonly=\"readonly\"></TD>";
Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* echo "\t<TD
align=\"center\">$InspName[$i]<br>$InspAddress[$i]<br>
$InspCity[$i] $Inspzip[$i]</TD>";
Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* echo "\t<TD align=\"center\">$InspDays[$i]</TD>";
Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* echo "\t<TD><select name=\"status$i\"
VALUE=\"\"><option
value=\"\"></option><option value=\"TD\">TD</option><option
value=\"M\">M</option><option value=\"Other\">Other</option><option
value=\"Rural\">Rural</option><option value=\"Gated\">Gated</option><option
value=\"APPT\">APPT</option></TD>";
Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â*echo "\t<td><input type=\"text\" value=\"Select
Date\"
name=\"SelectedDate$i\" id=\"SelectedDate$i\" readonly=\"readonly\"
size=\"10\" onClick=\"GetDate(this, $i);\">";
Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* echo "\t<TD><textarea rows=\"3\" cols=\"25\"
name=\"year$i\"></textarea></TD>";
Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* echo "</TR>\n";
Â* Â* Â* Â* Â* Â* Â* Â* }
Thanks!
--
news |