Hidden form field to update record *solved* (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


lovduv -> Hidden form field to update record *solved* (10/26/2005 13:26:37)

I need the proper string for a hidden form element.
This is what I am using now:
<input type=hidden name=blogid value=<%("BlogID")%>>

I have a table using a primary key field name BlogID, that I need to pass through a form as a hidden form field to identify an update to the record. For more info regarding my overall issue this is the oher info I have already posted

http://www.frontpagewebmaster.com/m-295274/tm.htm

Thanks in Advance![:)]




dpf -> RE: Hidden form field to update record (10/26/2005 13:27:31)

quote:

<input type=hidden name=blogid value=<%("BlogID")%>>
change <% to <%=




lovduv -> RE: Hidden form field to update record (10/26/2005 13:30:12)

Ok ...maybe I am getting closer, and I am getting excited lol

Now I get this error:
Database Results Wizard Error
Description: Parameter ?_2 has no default value.
Number: -2147217904 (0x80040E10)
Source: Microsoft JET Database Engine

lovduv[:o]




rdouglass -> RE: Hidden form field to update record (10/26/2005 13:41:54)

Before you post the form, view the source of the page to see if you are indeed picking up a BlogID.




lovduv -> RE: Hidden form field to update record (10/26/2005 20:00:32)

Hmmm.. the BlogId is indeed not there, but the info from blog post is there?

here is the source:

<td valign="top">
<form method="POST" action="update_blog.asp">
<p> </p>
<p><textarea rows="13" name="BlogPost" cols="77">Test, you guessed it #4</textarea></p>
<input type=hidden name=blogid value=BlogID>
<p><input type="submit" value="Submit" name="B1"></p>
</form>




Spooky -> RE: Hidden form field to update record (10/26/2005 20:02:40)

What is the asp source for that page?




lovduv -> RE: Hidden form field to update record (10/26/2005 20:10:41)

<td valign="top">
<form method="POST" action="update_blog.asp">
<p> </p>
<p><textarea rows="13" name="BlogPost"cols="77"><%=request ("BlogPost")></textarea></p>
<input type=hidden name=blogid value=<%=("BlogID")%>>
<p><input type="submit" value="Submit" name="B1"></p>
</form>
<p> </td>



When I look at the 2 asp source and live source, there is no request for BlogID is that the problem?




lovduv -> RE: Hidden form field to update record (10/26/2005 20:45:19)

<p><textarea rows="13" name="BlogPost"cols="77"><%=request ("BlogPost")></textarea></p>

This records info is pulled by a hyerlink in a DRW on the previous page, and it works it pulls the info, from whatever records hyperlink I click.

How do I pull the BlogID and pass it to the form?

For BlogPost I used the parameters:
<%=FP_FieldURL(fp_rs,"BlogPost")%>

What would I use for BlogID?

lovduv




Spooky -> RE: Hidden form field to update record (10/26/2005 21:26:12)

Im guessing this :

<input type=hidden name=BlogID value="<%=FP_FieldURL(fp_rs,"BlogID")%>">




lovduv -> RE: Hidden form field to update record (10/26/2005 22:29:43)

Pulling my hair out is begining to sound good![:@]

Ok now on the bottom of the form page I get this:

Microsoft VBScript runtime error '800a000d'

Type mismatch: 'FP_FieldURL'

/update.asp, line 118




rdouglass -> RE: Hidden form field to update record (10/26/2005 22:35:19)

quote:

Type mismatch: 'FP_FieldURL'


Looks like you may have put a DRW-only variable outside a DRW.

Make sure they are in between the two fp include lines. If you need to use a DRW value outside a DRW, you'll need to define it and assign it the value.

<%DIM myVariable%>
....

....
<!--#include file="_fpclass/fpdbrgn1.inc"-->
<%myVariable = FP_Field(fp_rs,"myDBField")%>
<!--#include file="_fpclass/fpdbrgn2.inc"-->
....

Then you can use it like so:

<%=myVariable%>

That make any sense? Does it apply here?




lovduv -> RE: Hidden form field to update record (10/26/2005 22:56:53)

I think it's between the includes?

This is the DRW, I hyperlink from:


fp_sQry="SELECT * FROM Blog ORDER BY DateAdded DESC"
fp_sDefault=""
fp_sNoRecords="<tr><td colspan=3 align=""LEFT"" width=""100%"">No records returned.</td></tr>"
fp_sDataConn="Database1"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=5
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_sColTypes="&BlogID=3&UserID=3&UserName=202&BlogDateYear=3&BlogDateDay=3&BlogDateMonth=202&DateAdded=135&RemoteAddress=202&BlogPost=203&"
fp_iDisplayCols=3
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>
<!--#include file="_fpclass/fpdbrgn1.inc"-->
<!--webbot bot="DatabaseRegionStart" endspan i-checksum="27089" --><tr>
<td>
<a href="update.asp?BlogPost=<%=FP_FieldURL(fp_rs,"BlogPost")%>&BlogID=<%=FP_FieldURL(fp_rs,"BlogID")%>">
<!--webbot bot="DatabaseResultColumn" s-columnnames="BlogID,UserID,UserName,BlogDateYear,BlogDateDay,BlogDateMonth,DateAdded,RemoteAddress,BlogPost" s-column="BlogID" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1">&lt;&lt;</font>BlogID<font size="-1">&gt;&gt;</font>" startspan s-ColumnTypes="3,3,202,3,3,202,135,202,203" --><%=FP_FieldVal(fp_rs,"BlogID")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="14502" --></a></td>
<td>
<!--webbot bot="DatabaseResultColumn" s-columnnames="BlogID,UserID,UserName,DateAdded,RemoteAddress,BlogPost" s-column="DateAdded" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1">&lt;&lt;</font>DateAdded<font size="-1">&gt;&gt;</font>" startspan --><%=FP_FieldVal(fp_rs,"DateAdded")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="17234" --></td>
<td>
<!--webbot bot="DatabaseResultColumn" s-columnnames="BlogID,UserID,UserName,DateAdded,RemoteAddress,BlogPost" s-column="BlogPost" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1">&lt;&lt;</font>BlogPost<font size="-1">&gt;&gt;</font>" startspan --><%=FP_FieldVal(fp_rs,"BlogPost")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="15851" --></td>
</tr>
<!--webbot bot="DatabaseRegionEnd" b-tableformat="TRUE" b-menuformat="FALSE" u-dbrgn2="_fpclass/fpdbrgn2.inc" i-groupsize="5" clientside tag="TBODY" preview="<tr><td colspan=64 bgcolor="#FFFF00" width="100%"><font color="#000000">This is the end of a Database Results region.</font></td></tr><TR><TD VALIGN=MIDDLE COLSPAN=64><NOBR><INPUT TYPE=Button VALUE=" |< "><INPUT TYPE=Button VALUE=" < "><INPUT TYPE=Button VALUE=" > "><INPUT TYPE=Button VALUE=" >| "> [1/5]</NOBR><BR></td></tr>" startspan --><!--#include file="_fpclass/fpdbrgn2.inc"-->
<!--webbot bot="DatabaseRegionEnd" endspan i-checksum="62730" --></tbody>




Spooky -> RE: Hidden form field to update record (10/26/2005 23:38:53)

Try this :

<input type=hidden name=BlogID value="<%=request.querystring("BlogID")%>">




lovduv -> RE: Hidden form field to update record (10/27/2005 0:06:48)

Man, I need to take a class or something. The live source code of the form is still not passing on the BlogID
Ok to recap:

edit.asp has a DRW with the BlogId as the link to
update.asp which has a form with only one text area, populated with the info from DRW on edit.asp
this form submits to a DRW on update_blog.asp
I use parameters in the BlogID hyperlink to populate the form on update.asp, the parameter I use is:
<%=FP_FieldURL(fp_rs,"BlogPost")%> for BlogPost..and
<%=FP_FieldURL(fp_rs,"BlogID")%> for BlogId

The BlogPost parameter is working, but BlogID is not

This is where I have the records DRW http://www.missyandross.com/editblog.asp
This is where you edit the record with the form http://www.missyandross.com/update.asp?BlogPost=Test%2C+you+guessed+it+%234
This is where I have the DRW to process the update http://www.missyandross.com/update_blog.asp
Please take a look!




Spooky -> RE: Hidden form field to update record (10/27/2005 0:16:17)

Well - you are closer, because now it contains the ID of the record!
I submitted a record and it was updated. Game over? [;)]




lovduv -> RE: Hidden form field to update record (10/27/2005 0:30:31)

I have no idea how that happened, BUT WHOO HOO!!!!!!

Thank you all so much...until next time! lol[:D][:D][:D]


lovduv




lovduv -> RE: Hidden form field to update record (10/27/2005 1:38:09)

Ouch spoke to soon![>:]

If you try to update one of the larger posts, it does not populate in the form. From the reading I have been doing, this is probably from trying to pass a large amount of text via a hyperlink. Is there a workaround, so that I can get the larger posts to poulate?

lovduv




Spooky -> RE: Hidden form field to update record (10/27/2005 1:51:43)

Yes - dont pass a large amount of text via the hyperlink ;-)

You should pass the ID only to the query page. The query page then gets the full text associated with the record (from the database)
You then POST the data to the update page.




lovduv -> RE: Hidden form field to update record (10/27/2005 2:12:30)

If I remove this parameter in the hyperlink, then the forms text area is blank.
<%=FP_FieldURL(fp_rs,"BlogPost")%> for BlogPost

Should I change the initial value of the text area to something like this:

<textarea rows="13" name="BlogPost" cols="77">=BlogPost value="<%=request.querystring("BlogPost")%>">


Also on this page
http://www.missyandross.com/editblog.asp
I changed it to have an update link and delete link

Update is working, but how would I make it delete the record?




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.09375