Click to See Complete Forum and Search --> : Substitute for this.form ?


pankaj_it09
02-07-2007, 05:17 AM
In the below code each loop as a FORM.
I use these FORMS in the onChange event.

Is there any substitute for FORM ?

<TMPL_LOOP NAME="AttachedFiles">
<form name="attach_<TMPL_VAR NAME=datetime><TMPL_VAR NAME=filename>">
<tr>
<td class="plogitemselectable" align="center"width="10%"><TMPL_VAR NAME="filesig"></td>
<td class="plogitemselectable" align="center" width="20%"><TMPL_VAR NAME="datetime"></td><td class="plogitemselectable" align="center"><a href="/cgi-bin/tps/attach_file.cgi?act=search&filename=<TMPL_VAR NAME=filename>&conid=<TMPL_VAR NAME=conid>&datetime=<TMPL_VAR NAME=datetime>"><TMPL_VAR NAME="filename"></a></td><td class="plogitemselectable"><TMPL_VAR NAME="comment"></td><td class="plogitemselectable" align="center"><TMPL_VAR NAME="type"></td><td class="plogitemselectable" align="center"><input type="checkbox" name="hidefile" "<TMPL_VAR NAME=hidefile>" onChange="updateHideStatus(this.form,'<TMPL_VAR NAME=datetime>','<TMPL_VAR NAME=filename>');"/></td>
</tr>
</form>
</TMPL_LOOP>

Charles
02-07-2007, 05:37 AM
Is there any substitute for FORM ?Certainly, but I would have to know just what it is that you are up to.

pankaj_it09
02-07-2007, 06:10 AM
I want to achieve the same goal but different HTML tag.

For eg:- I am using this.form above.

I want to use something like this.div if DIV can be a substitute ?

Charles
02-07-2007, 06:25 AM
And just what is the thing that is being achieved now?

pankaj_it09
02-07-2007, 07:50 AM
The thing which is achieved is providing uniqueness to the DATA of each LOOP.

There are loops of form .
You can see in the code.

Charles
02-07-2007, 08:24 AM
You can see in the code.Actually no, I cannot. You have a reference to some function that is not there defined and you have a whole lot of stuff there that is neither HTML, JavaScript or anything else that is known to me.

Stephen Philbin
02-07-2007, 12:26 PM
Generally, if you want to make an element unique throughout the entire document, you should use the id attribute. An id attribute value must be unique throughout the entire document. So with javascript, you could use
var target_form = document.getElementById('the id attribute you gave to the form');

Though I'm not sure what you use with whatever that is you've posted. Is it Coldfusion or asp.Net or something?

ray326
02-07-2007, 08:50 PM
The whole pattern is invalid. You need to wrap the table in a single form.

pankaj_it09
02-08-2007, 12:19 AM
Actually no, I cannot. You have a reference to some function that is not there defined and you have a whole lot of stuff there that is neither HTML, JavaScript or anything else that is known to me.

Forget about that function.

I want a substitute for form.
I am using this.form to access the DATA of each LOOP.

I want another HTML tag that can achieve the same goal
For eg:- if the other HTML tag is <div> then this.div

pankaj_it09
02-08-2007, 12:32 AM
Generally, if you want to make an element unique throughout the entire document, you should use the id attribute. An id attribute value must be unique throughout the entire document. So with javascript, you could use
var target_form = document.getElementById('the id attribute you gave to the form');

Though I'm not sure what you use with whatever that is you've posted. Is it Coldfusion or asp.Net or something?

I am using Perl and HTML templates.
When the code which I have posted is in a HTML template it works fine but it doesn't work when it is in Perl code.

I don;t want to use ID becoz I don;t want to change the code.

pankaj_it09
02-08-2007, 12:34 AM
The whole pattern is invalid. You need to wrap the table in a single form.


I am creating loops of forms.

If I follow you then I have to create loops of tables.

Will it be fine ?

pankaj_it09
02-08-2007, 01:01 AM
well the actual problem is that when I put the below code in Perl I can't see the form and the inside contents. So I wanted another tag .


my $i;
foreach $i (0 ..$#attachedfiledata) {
$str .= "<form name=\"attach_$attachedfiledata[$i]{'datetime'}$attachedfiledata[$i]{'filename'}\">";
$str .= "<tr>";
$str .= "<td class=\"plogitemselectable\">$attachedfiledata[$i]{'filesig'}</td>";
$str .= "<td class=\"plogitemselectable\">$attachedfiledata[$i]{'datetime'}</td><td class=\"plogitemselectable\"><a href=\"/cgi-bin/tps/attach_file.cgi?act=search&filename=$attachedfiledata[$i]{'filename'}&conid=$attachedfiledata[$i]{'conid'}&datetime=$attachedfiledata[$i]{'datetime'}\">$attachedfiledata[$i]{'filename'}</a></td><td class=\"plogitemselectable\">$attachedfiledata[$i]{'comment'}</td><td class=\"plogitemselectable\">$attachedfiledata[$i]{'type'}</td><td class=\"plogitemselectable\" align=\"center\"><input type=\"checkbox\" name=\"hidefile\" $attachedfiledata[$i]{'hidefile'} onChange=\"updateHideStatus('<TMPL_VAR NAME=datetime>','<TMPL_VAR NAME=filename>');\"/></td>";
$str .= "</tr>";
$str .= '</form>';
}

ray326
02-08-2007, 01:16 PM
Syntactically you need either
<form>
<table>
foreach
<tr><td></td></tr>
</table>
</form>
or
foreach
<form>
<table>
<tr><td></td></tr>
</table>
</form>

pankaj_it09
02-09-2007, 12:15 AM
No Ray that will not solve the problem.

If I go by your second way then will this.form work ?

ray326
02-09-2007, 01:40 PM
It should.