One Button and a check Box on a Form, One to edit

Results 1 to 2 of 2

Thread: One Button and a check Box on a Form, One to edit

  1. #1
    Kevin M Guest

    Default One Button and a check Box on a Form, One to edit

    My form displays rows of data from an Access db.<BR>There is a "edit" button and a check box (displayed on each row). There is also ONE "Delete" button in the table header.<BR><BR>The edit button when clicked posts that row to another form ("DataEdit.asp") for editing, and the Check boxes when checked and delete button clicked should delete the checked rows to another form "DataDelete.asp", rather like deleting messages in a Hotmail account.<BR><BR>I have tried the following javascript (and changing the button types), which works fine in a form which displays only ONE record at a time but gives me a "Debug Error" when used in a form which displays multiple rows of data (the one in question).<BR><BR>Here is a sample of my code....<BR><BR>&#060;head&#062;<BR>&#060;script language="javascript"&#062;<BR>&#060;!--<BR>function EditCurrent() {<BR>document.MyForm.action="DataEdit.asp";<BR>doc ument.MyForm.submit(); //THIS IS THE LINE THAT IS HIGHLIGHTED <BR>//IN THE DEBUG WINDOW<BR>}<BR>function DeletData() {<BR>document.MyForm.action="DataDelete.asp";<BR>d ocument.MyForm.submit();<BR>}<BR>//--&#062;<BR>&#060;/script&#062;<BR>&#060;FORM NAME="MyForm" METHOD="Post"&#062;<BR><BR>Table header.....<BR>&#060;INPUT type="Normal" value="Delete" name="cmdDel" onclick="DeleteData()"&#062;<BR><BR>Table....<BR>D o While etc....Code to loop through recordset and display table data etc<BR>&#060;INPUT type="button" value="Edit" name="cmdEdit" onclick="EditCurrent()"&#062;<BR>&#060;INPUT type="checkbox" name="chkDelete" value="&#060;%=rst("EventID")%&#062;"&#062;<BR>rst .MoveNext<BR>Loop<BR><BR>The edit button will work fine if I use...<BR>&#060;FORM NAME="MyForm" METHOD="Post" Action="DataEdit.asp"&#062;<BR>and change it to a "Submit" type, but then I won&#039;t be able to go to the "DeleteData.asp" page if the Delete button is pressed!<BR><BR>I&#039;ve tried using vbscript but that just returns the FIRST record everytime, regardless of which row&#039;s button is clicked.<BR><BR>Note, I need to use the "Post" method rather than a query string.<BR><BR>What am I doing wrong?<BR>Please help!!<BR><BR>Many Thanks<BR><BR>Kevin M<BR><BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default I do not see it...

    &#062; The edit button when clicked posts that row to another form ("DataEdit.asp") for editing,<BR><BR>I&#039;m sorry, but I just don&#039;t see that, at all! In the code you show, the edit button indeed submits the form, but I see absolutely *nothing* that is being sent to the next page that tells it *what* button (of the many on the form!) was pushed.<BR><BR>I think you are missing something big here, no? Or did you just not show that part of your code?<BR><BR>How about this...<BR><BR>Bring up the page in your browser and then do " View &#124 Source " and capture the HTML you are displaying. Then copy/paste that HTML code (*not* the original ASP) here for us to see. Please feel free to cut out all the extraneous stuff (background images, only show a couple of rows of data, etc.), but don&#039;t leave out *any* JS code.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts