Support Forum Softcomplex logo
About Us  | Services  | Download  | Order  | Support  | |
| Search | Today's Posts | Stats | Board Rules | Not logged in [ Login | Register ]
go to bottom
Last active: Never

Printable Version | Subscribe | Add to Favourites   Post new thread
Author: Subject: Can use calendar in normal but not in array, please help! SOLVED!
Porsche.V
Newbie

Posts: 1
Registered: 5/28/2008
Member Is Offline
posted on 5/28/2008 at 10:40 AM Reply With Quote
Can use calendar in normal but not in array, please help! SOLVED!


hi, when i use the calendar in normal htlm:

<form id="form1" name="form1" method="post">
<p>Insert Date:
<input type="text" size= '12' name="txt_data" id="txt_data" value="">
<a href="javascript:cal1.popup();"><img src="imagens/cal.gif" width="16" height="16" border="0" alt="Click Here to Pick up the date"></a>
</p>
<p>
<input type="submit" name="butao_dia" id="butao_dia" value="Dia" />
<input type="submit" name="butao_semana" id="butao_semana" value="Semana" />
</p>
</form>
<script language="JavaScript">
var cal1 = new calendar1(document.forms['form1'].elements['txt_data']);
cal1.year_scroll = true;
cal1.time_comp = false;
</script>

if works very well, but, in the same page i have php, and i am listing form the db some information of a production line, and, in each one of the results, i have a field for date, that i wanted to be filled through the calendar. but it doesn't work, sometimes i get the "error calling the calendar: no target control specified":

print "<form name='listofrequests' align='center' valign='top' method='post' action='update.php'>n";

while ($orders = mssql_fetch_array($result)) {
print "<input type='hidden' name='iditem[$i]' value='{$orders['iditem']}' />";
.
.
.
print "<table><tr bgcolor={$bgcolor}><td width='30'><input type='checkbox' name='acceptedd[$i]' /></td><tdwidth='100'> {$orders['idmodelo']} </td></td><td width='150'>{$orders['idproduto']} </td><td width='50'>{$orders['idpele']} </td><td width='30'>{$orders['cor']} </td><tdwidth='40'>{$orders['ordemfabrico']} </td><td width='30'>{$orders['qtd']} </td><td width='80'>{$orders['dt']}</td><td><input type='text' size='12' name='prevista[$i]'value='{$orders['dtpropostaentrega']}'><a href='javascript:cal2.popup();'><img src='imagens/cal.gif' width='16' height='16' border='0' alt='Click Here to Pick up the date'></a></td></table>n";

++$i;
}
print "</form>";
print "<script language='JavaScript'>";
print "var cal2 = new calendar1(document.forms['listofrequests'].elements['prevista[$i]']);";
print "cal1.year_scroll = true;";
print "cal1.time_comp = false;";
print "</script>";

i am using the arrays because i need them to update some date to the lines that have the checkbox checked..

now, if i put like this:

print "<script language='JavaScript'>";
print "var cal2 = new calendar1(document.forms['listofrequests'].elements['prevista[$i]']);";
print "cal1.year_scroll = true;";
print "cal1.time_comp = false;";
print "</script>";
++$i;
}
print "</form>"

before /form, the calendar opens and puts the date in the field, but only in the last line. (there is a calendar in the end of each line, the ideia is for each line open the calendar and put the date in the date field of that line) and if there 10 lines od results, and i open the calendar from the 1st line it puts the date in the 10th field..

hope you can help me..

thanks a lot

SOLUTION:

<input type='text' size='12' name='prevista[$i]' value='{$orders['dtpropostaentrega']}'>

<a href='javascript: cal$i.popup() ;'>

<img src='imagens/cal.gif' width='16' height='16' border='0' alt='Click Here to Pick up the
date'></a></td></table>\n";

print "<script language='JavaScript'>";

print "var cal$i = new calendar1(document.forms['listofrequests'].elements['prevista[$i]']);";

print "cal1.year_scroll = true;";
print "cal1.time_comp = false;";
print "</script>";
View User's Profile View All Posts By User U2U Member
Post new thread

Related Links:
Product Page
Product Demonstrations Live Demos
Free Download Free Download
Product Documentation Documentation
Support Forum Support Forum
 

Go To Top


Powered by XMB 1.9.1 Nexus
Developed By Aventure Media & The XMB Group © 2002-2004