The problem is that the value for the field 'CatLinks.CategoryID' mysteriously gets replaced. To get the proper value, a global needs to be used and a new instance of GT::CGI must be started. (ie, you can't rely on $IN because the value for 'CatLinks.CategoryID' is munged when the script starts.)
here are some general instructions...
form_input
my $cgi = new GT::CGI;
my $field = shift;
return $cgi->param($field);
}
Category_Full_Name
my $id = shift;
my $cat = $DB->table("Category")->select("Full_Name", { ID => $id })->fetchrow();
return $cat;
}
in modify.cgi:
<%Category_Full_Name($cat_id)%>
In include_form.html:
<%if preview%>
<option value="<%escape_html ID%>"<%if ID == $cat_id%> selected="selected"<%endif%>><%' ' x $CatDepth%><%Name%></option>
<%else%>
<option value="<%escape_html ID%>"<%if selected%> selected="selected"<%endif%>><%' ' x $CatDepth%><%Name%></option>
<%endif%>
<%endloop%>
You need to use "form_input('field_name')" or "in.field_name" pre-fill the form input boxes. IE, do NOT use 'URL' -- use <%form_input('URL')%> or <%in.URL%>.
I'll work out some templates in a little bit.
Philip
------------------
Limecat is not pleased.
here are some general instructions...
form_input
Code:
sub { my $cgi = new GT::CGI;
my $field = shift;
return $cgi->param($field);
}
Category_Full_Name
Code:
sub { my $id = shift;
my $cat = $DB->table("Category")->select("Full_Name", { ID => $id })->fetchrow();
return $cat;
}
in modify.cgi:
Code:
<%set cat_id = form_input('CatLinks.CategoryID')%> <%Category_Full_Name($cat_id)%>
In include_form.html:
Code:
<%loop category_loop%> <%if preview%>
<option value="<%escape_html ID%>"<%if ID == $cat_id%> selected="selected"<%endif%>><%' ' x $CatDepth%><%Name%></option>
<%else%>
<option value="<%escape_html ID%>"<%if selected%> selected="selected"<%endif%>><%' ' x $CatDepth%><%Name%></option>
<%endif%>
<%endloop%>
You need to use "form_input('field_name')" or "in.field_name" pre-fill the form input boxes. IE, do NOT use 'URL' -- use <%form_input('URL')%> or <%in.URL%>.
I'll work out some templates in a little bit.
Philip
------------------
Limecat is not pleased.