Database results weirdness

H

H8ids

Used the FP2003 wizard to create an online ASP submission form that saves to
an Access database.
The form does have radio buttons relating to a question. Without renaming of
"values" the editor page correctly returns a saved radio button selection.

BUT, once I change the value names to suite my need, the editor page fails
to return the saved selection.
I've recreated the webpage and can confirm that the issue is when the values
are changed from "Option 1" to "Advent"

The changes were adjusted in the submission form and editor form.
There aren't any typos.

No idea why the coding can't handle a change of value.
 
T

Tom

After you changed the values, you need to remap your fields to the database
column.

Right click in form, form properties, Options (button), Saved Fields (tab)

Tom
 
H

H8ids

Tom,

I looked into your suggestion of confirmed specific database fields.
Uploaded the submission form and created a new entry. But I'm still getting
the same results.
The edit page doesn't seem to recognize the database information
accurately. It does pull the correct textual information.
Perhaps I have the database fields identified incorrectly. Presently
they are set to Data Type "text" and Display Control "Text Box", simply
because I did not see an option for Boolean. Should the settings be
different. Perhaps "DataType" = Yes/No with "Display Control" = "Check Box"?

David
 
T

Tom

Please post the code so we can see

H8ids said:
Tom,

I looked into your suggestion of confirmed specific database fields.
Uploaded the submission form and created a new entry. But I'm still getting
the same results.
The edit page doesn't seem to recognize the database information
accurately. It does pull the correct textual information.
Perhaps I have the database fields identified incorrectly. Presently
they are set to Data Type "text" and Display Control "Text Box", simply
because I did not see an option for Boolean. Should the settings be
different. Perhaps "DataType" = Yes/No with "Display Control" = "Check Box"?

David
 
H

H8ids

Tom,

If I accept the default "Option 1", "Option 2", etc. then I never run into a
problem. The mis-representation begins once the "Value" has been updated. No
changes are being made to the database and the new value is just text.
The pages were generated from FrontPage 2003 and I selected VBScript for the
coding language. Looking at the code below, it appears that FrontPage didn't
re-code all of the pages from JavaScript to VBScript.
Here is the code for the Submission (VBScript), Detail(JavaScript) and
Edit(JavaScript and VBScript) ASP pages:
Thanks for your assistance.
David



*****************Submission page:

<%
On Error Resume Next
Session("FP_OldCodePage") = Session.CodePage
Session("FP_OldLCID") = Session.LCID
Session.CodePage = 1252
Err.Clear

strErrorUrl = ""

If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
If Request.Form("VTI-GROUP") = "0" Then
Err.Clear

Set fp_conn = Server.CreateObject("ADODB.Connection")
FP_DumpError strErrorUrl, "Cannot create connection"

Set fp_rs = Server.CreateObject("ADODB.Recordset")
FP_DumpError strErrorUrl, "Cannot create record set"

fp_conn.Open Application("coursesubmitterdb_ConnectionString")
FP_DumpError strErrorUrl, "Cannot open database"

fp_rs.Open "Results", fp_conn, 1, 3, 2 ' adOpenKeySet, adLockOptimistic,
adCmdTable
FP_DumpError strErrorUrl, "Cannot open record set"

fp_rs.AddNew
FP_DumpError strErrorUrl, "Cannot add new record set to the database"
Dim arFormFields0(27)
Dim arFormDBFields0(27)
Dim arFormValues0(27)

arFormFields0(14) = "CourseLab"
arFormDBFields0(14) = "CourseLab"
arFormValues0(14) = Request("CourseLab")

FP_SaveFormFields fp_rs, arFormFields0, arFormDBFields0

fp_rs.Update
FP_DumpError strErrorUrl, "Cannot update the database"

fp_rs.Close
fp_conn.Close

FP_FormConfirmation "text/html; charset=windows-1252",_
"Form Confirmation",_
"Thank you for submitting the following information:",_
"submission_form.asp",_
"Return to the form."

End If
End If

Session.CodePage = Session("FP_OldCodePage")
Session.LCID = Session("FP_OldLCID")

%>
<% Response.Buffer = True %>

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Results -- New</title>
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
</head>

<body bgcolor="#FFFFFF">

<table width="100%" align=left>
<tr>
<td width="50%">
<b><font size=+3 color="#000080"> Course Submission Form </font></b>
</td>
<td width="50%" align=right>
<table>
<tr>
<td>
<a href="../results_page.asp" target="_top">Results Page</a> |
Submission Form
| <a href="database_editor.asp" target="_top">Database Editor</a>

</td>
</tr>
</table>
</td>
</tr>
</table>


<p>
<br clear="all">
<hr>
<p>

<!--webbot BOT="GeneratedScript" PREVIEW=" " startspan -->
<script Language="VBScript" Type="text/vbscript">
<!--
function FrontPage_Form1_onsubmit()
Set theForm = document.FrontPage_Form1

radioSelected = False
For i = 0 to theForm.CourseLab.length - 1
If (theForm.CourseLab.item(i).checked) Then
radioSelected = True
End If
Next
If (Not radioSelected) Then
MsgBox "Please select one of the ""CourseLab"" options.", 0, "Validation
Error"
FrontPage_Form1_onsubmit = False
Exit Function
End If

--></script>
<!--webbot BOT="GeneratedScript" endspan --><form METHOD="POST"
action="submission_form.asp" name="FrontPage_Form1"
webbot-action="--WEBBOT-SELF--">

<!--webbot bot="SaveDatabase" SuggestedExt="asp"
S-DataConnection="coursesubmitterdb" S-RecordSource="Results"
S-Form-Fields="CourseLab" S-Form-DBFields="CourseLab"
U-ASP-Include-Url="../../../_fpclass/fpdbform.inc" startspan
U-Database-URL="../../../fpdb/coursesubmitterdb.mdb"
S-Builtin-Fields="REMOTE_HOST HTTP_USER_AGENT Timestamp REMOTE_USER"
S-Builtin-DBFields="Remote_computer_name Browser_type Timestamp
User_name" --><input TYPE="hidden" NAME="VTI-GROUP" VALUE="0"><!--#include
file="../../../_fpclass/fpdbform.inc"--><!--webbot bot="SaveDatabase"
endspan i-checksum="52631" -->

<p><b>Course lab: </b>
&nbsp;<!--webbot bot="Validation" s-display-name="Key,CourseLab"
b-value-required="TRUE" -->
<input type="radio" name="CourseLab" value="Yes" tabindex="7" >Yes&nbsp;
<input type="radio" name="CourseLab" value="No" tabindex="8" >No<br>
</p>

<p><input type="submit" value=" OK " tabindex="38"><input type="reset"
value=" Reset " tabindex="39"></p>

</form>

</body>

</html>



********************Detail List page:

<html>

<head>
<% ' FP_ASP -- ASP Automatically generated by a FrontPage Component. Do not
Edit.
FP_CharSet = "windows-1252"
FP_CodePage = 1252 %>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Results -- Home</title>
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
</head>

<body bgcolor="#FFFFFF">

<!--webbot bot="PurpleText" PREVIEW="-Important- If you modify this
Database Results region using the Database Results Wizard, then your
Database Editor will no longer work. If you accidentally open the Database
Results Wizard, simply click Cancel to exit without regenerating the
Database Results region." -->
<!--webbot bot="DatabaseRegionStart"
s-columnnames="Key,CourseLab"s-columntypes="3,202"
s-dataconnection="coursesubmitterdb" b-tableformat="FALSE"
b-menuformat="FALSE" s-menuchoice s-menuvalue b-tableborder="TRUE"
b-tableexpand="TRUE" b-tableheader="TRUE" b-listlabels="TRUE"
b-listseparator="FALSE" i-ListFormat="5" b-makeform="FALSE"
s-RecordSource="Results" s-displaycolumns="Key,CourseLab"s-criteria="{Key}
EQ {Key} +" s-order s-sql="SELECT * FROM Results WHERE Key = ::Key::"
b-procedure="FALSE" clientside SuggestedExt="asp" s-DefaultFields="Key=0"
s-NoRecordsFound="No records returned." i-MaxRecords="1" i-GroupSize="0"
u-dblib="../../../_fpclass/fpdblib.inc"
u-dbrgn1="../../../_fpclass/fpdbrgn1.inc"
u-dbrgn2="../../../_fpclass/fpdbrgn2.inc" Tag="BODY" startspan BOTID="0"
preview="&lt;table border=0 width=&quot;100%&quot;&gt;&lt;tr&gt;&lt;td
bgcolor=&quot;#FFFF00&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;This is
the start of a Database Results region. The page must be fetched from a web
server with a web browser to display correctly; the current web is stored on
your local disk or
network.&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;" --><!--#include
file="../../../_fpclass/fpdblib.inc"-->
<% if 0 then %>

<SCRIPT Language="JavaScript">

document.write("<div style='background: yellow; color: black;'>The Database
Results component on this page is unable to display database content. The
page must have a filename ending in '.asp', and the web must be hosted on a
server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT * FROM Results WHERE Key = ::Key::"
fp_sDefault="Key=0"
fp_sNoRecords="No records returned."
fp_sDataConn="coursesubmitterdb"
fp_iMaxRecords=1
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=False
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_sColTypes="&Key=3&CourseLab=&"
fp_iDisplayCols=28
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>
<!--#include file="../../../_fpclass/fpdbrgn1.inc"-->
<!--webbot bot="DatabaseRegionStart" endspan -->

<table BORDER=1 style="border-collapse: collapse" cellpadding="3">

<tr>
<td><b>Key:</b></td>
<td>
<!--webbot bot="DatabaseResultColumn" s-columnnames="Key,CourseLab"
s-column="Key" b-tableformat="TRUE" b-hasHTML="FALSE" clientside startspan
b-makelink b-MenuFormat preview="&lt;font
size=&quot;-1&quot;&gt;&amp;lt;&amp;lt;&lt;/font&gt;Key&lt;font
size=&quot;-1&quot;&gt;&amp;gt;&amp;gt;&lt;/font&gt;" -->
<%=FP_FieldVal(fp_rs,"Key")%><!--webbot bot="DatabaseResultColumn"
endspan --></td>
</tr>
<tr>
<td><b>Course Lab:</b></td>
<td>
<!--webbot bot="DatabaseResultColumn"
s-columnnames="Key,CourseLab"s-column="CourseLab" b-tableformat="TRUE"
b-hasHTML="FALSE" clientside startspan b-makelink b-MenuFormat
preview="&lt;font
size=&quot;-1&quot;&gt;&amp;lt;&amp;lt;&lt;/font&gt;CourseLab&lt;font
size=&quot;-1&quot;&gt;&amp;gt;&amp;gt;&lt;/font&gt;"
s-ColumnTypes="3,202" -->
<%=FP_FieldVal(fp_rs,"CourseLab")%><!--webbot bot="DatabaseResultColumn"
endspan --></td>
</tr>

<form method="POST" action="edit.asp">
<input type="hidden" name="Key" value="<%=FP_FieldHTML(fp_rs,"Key")%>">
<p><input type="submit" value=" Edit " name="B1"></p>
</form>
</td>

<td>
<form method="POST" action="delete.asp">
<input type="hidden" name="Key" value="<%=FP_FieldHTML(fp_rs,"Key")%>">
<p><input type="submit" value="Delete" name="B1"></p>
</form>
</td>
</tr>
</table></td></tr>

</table>

<!--webbot bot="DatabaseRegionEnd" b-tableformat="FALSE"
b-menuformat="FALSE" u-dbrgn2="../../../_fpclass/fpdbrgn2.inc"
i-groupsize="0" clientside Tag="BODY" startspan preview="&lt;table border=0
width=&quot;100%&quot;&gt;&lt;tr&gt;&lt;td
bgcolor=&quot;#FFFF00&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;This is
the end of a Database Results
region.&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;" --><!--#include
file="../../../_fpclass/fpdbrgn2.inc"-->
<!--webbot bot="DatabaseRegionEnd" endspan -->

</body>

</html>


**********************Edit page:

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Results -- Edit</title>
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
</head>

<body bgcolor="#FFFFFF">
<!--webbot bot="PurpleText" PREVIEW="-Important- If you modify this
Database Results region using the Database Results Wizard, then your
Database Editor will no longer work. If you accidentally open the Database
Results Wizard, simply click Cancel to exit without regenerating the
Database Results region." -->

<!--webbot bot="DatabaseRegionStart"
s-columnnames="Key,CourseLab"s-columntypes="3,202"
s-dataconnection="coursesubmitterdb" b-tableformat="FALSE"
b-menuformat="FALSE" s-menuchoice s-menuvalue b-tableborder="TRUE"
b-tableexpand="TRUE" b-tableheader="TRUE" b-listlabels="TRUE"
b-listseparator="FALSE" i-ListFormat="5" b-makeform="FALSE"
s-RecordSource="Results" s-displaycolumns="Key,CourseLab"s-criteria="{Key}
EQ {Key} +" s-order s-sql="SELECT * FROM Results WHERE Key = ::Key::"
b-procedure="FALSE" clientside SuggestedExt="asp" s-DefaultFields="Key=0"
s-NoRecordsFound="No records returned." i-MaxRecords="1" i-GroupSize="0"
u-dblib="../../../_fpclass/fpdblib.inc"
u-dbrgn1="../../../_fpclass/fpdbrgn1.inc"
u-dbrgn2="../../../_fpclass/fpdbrgn2.inc" Tag="BODY" startspan BOTID="0"
preview="&lt;table border=0 width=&quot;100%&quot;&gt;&lt;tr&gt;&lt;td
bgcolor=&quot;#FFFF00&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;This is
the start of a Database Results region. The page must be fetched from a web
server with a web browser to display correctly; the current web is stored on
your local disk or
network.&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;" --><!--#include
file="../../../_fpclass/fpdblib.inc"-->
<% if 0 then %>

<SCRIPT Language="JavaScript">

document.write("<div style='background: yellow; color: black;'>The Database
Results component on this page is unable to display database content. The
page must have a filename ending in '.asp', and the web must be hosted on a
server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT * FROM Results WHERE Key = ::Key::"
fp_sDefault="Key=0"
fp_sNoRecords="No records returned."
fp_sDataConn="coursesubmitterdb"
fp_iMaxRecords=1
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=False
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_sColTypes="&Key=3&CourseLab=&"
fp_iDisplayCols=28
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>
<!--#include file="../../../_fpclass/fpdbrgn1.inc"-->
<!--webbot bot="DatabaseRegionStart" endspan -->
<!--webbot BOT="GeneratedScript" PREVIEW=" " startspan -->

<script Language="VBScript" Type="text/vbscript">

<!--function FrontPage_Form1_onsubmit()
Set theForm = document.FrontPage_Form1

radioSelected = False
For i = 0 to theForm.CourseLab.length - 1
If (theForm.CourseLab.item(i).checked) Then
radioSelected = True
End If
Next
If (Not radioSelected) Then
MsgBox "Please select one of the ""CourseLab"" options.", 0, "Validation
Error"
FrontPage_Form1_onsubmit = False
Exit Function
End If

FrontPage_Form1_onsubmit = True
End Function
-->
</script>
<!--webbot BOT="GeneratedScript" endspan -->
<form METHOD="POST" action="update.asp" name="FrontPage_Form1">
<table BORDER=1 style="border-collapse: collapse" cellpadding="3">


<tr>
<td><b>Course Lab:</b></td>
<td><p>
<!--webbot bot="Validation" s-display-name="CourseLab"
b-value-required="TRUE" -->
<input type="radio" name="CourseLab" <% if "Yes" =
FP_Field(fp_rs,"CourseLab") then %> <% end if %> value="Yes" checked>Yes<br>
<input type="radio" name="CourseLab" <% if "No" =
FP_Field(fp_rs,"CourseLab") then %> <% end if %> value="No" checked >No</p>
</td>
</tr>

</table>

<input type="hidden" name="Key" value="<%=FP_FieldHTML(fp_rs,"Key")%>">
</form>

<!--webbot bot="DatabaseRegionEnd" b-tableformat="FALSE"
b-menuformat="FALSE" u-dbrgn2="../../../_fpclass/fpdbrgn2.inc"
i-groupsize="0" clientside Tag="BODY" startspan preview="&lt;table border=0
width=&quot;100%&quot;&gt;&lt;tr&gt;&lt;td
bgcolor=&quot;#FFFF00&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;This is
the end of a Database Results
region.&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;" --><!--#include
file="../../../_fpclass/fpdbrgn2.inc"-->
<!--webbot bot="DatabaseRegionEnd" endspan -->

</body>

</html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top