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: problem with formfield name php variable
sonofagun
Junior Member

Posts: 2
Registered: 6/18/2003
Location: Cairns Australia
Member Is Offline
posted on 6/18/2003 at 12:44 AM Reply With Quote
problem with formfield name php variable


Hi,

I am writting a booking form script for my website and have decided to include the Tigra Calendar. My problem is that the form field name changes for each new booking added. Basically what happens is that when "add new booking" is selected the next record id is appended to the field name i.e If the field is named Indate, once php has processed the page the form field name appears as Indate(3). 3 is the next record id. I have provided the code in two sections.

1) PHP Script
2) The processed page output


1)<td nowrap bgcolor="#1e90ff"><input name='outdate(<?php echo $cnsaptsbookings->AbsolutePosition()?>)' value='<?php echo fixHTMLquotes($cnsaptsbookings->Value("outdate")) ?>' size="12" onfocus="this.blur()"><a href="javascript:void(0)" onclick="gfPop.fEndPop(document.cnsapts.indate(<?php echo $cnsaptsbookings->AbsolutePosition()?>),document.cnsapts.outdate(<?php echo $cnsaptsbookings->AbsolutePosition()?>));return false;" HIDEFOCUS><img name="popcal" align="absbottom" src="calbtn.gif" width="34" height="22" border="0" alt=""></a></td>

2) <td nowrap bgcolor="#1e90ff">
<input name='indate(4)' value='' size="12" onfocus="this.blur()"><a href="javascript:void(0)" onclick="gfPop.fStartPop(document.cnsapts.indate(4),document.cnsapts.outdate(4));return false;" HIDEFOCUS><img name="popcal2" align="absbottom" src="calbtn.gif" width="34" height="22" border="0" alt=""></a></td>

I don't know much about Javascript but I have a feeling it doesn't like the outputted syntax.

Any Help would be appreciated.

Best Regards
Steve Laws
View User's Profile View All Posts By User U2U Member
nik


Posts:
Registered: 1/1/1970
Member Is Offline
posted on 6/18/2003 at 02:37 PM Reply With Quote

It's not preferable to use brackets in input names. () in JavaScript usually follow function name or are used for priority indication in arithmetical expressions. That's why construction


document.cnsapts.indate(4)


isn't reference to form element for JavaScript. So you should use the following construction:

document.forms['cnsapts'].elements['indate(4)']
View User's Profile View All Posts By User U2U Member
sonofagun
Junior Member

Posts: 2
Registered: 6/18/2003
Location: Cairns Australia
Member Is Offline
posted on 6/19/2003 at 04:08 AM Reply With Quote
Thanks


Worked like a charm.

Many thanks for your help.

Regards
Steve
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