|
good day!
i want to ak, in first.asp, displays the checkbox and the value is the ID of the table LOAForms. In this page it will display all the info of all employee.
my codes is this
set rs = server.createobject("ADODB.Recordset")
sql="Select * from LOAForms where status=`pending` "
rs.Open sql, conn,3,3
<form action="/forum/2nd.html" method="post" >
if not rs.eof then
do
<input type="checkbox" name="delitem3" value="<%=rs("id")%>">
rs.movenext
loop until rs.eof
end if
</form
<input type="submit" name="btntype" value="Disapprove Leave" >
codes in 2nd.asp.
In this page, it will update all checked boxes
intdelitem = trim(request("delitem"))
if intdelitem <> "" then
disapp = "disapproved"
Set rsapproveLOA = Server.CreateObject("ADODB.Recordset")
sqlXDel1 = "Update LOAForms Set status1=`"& cancelled &" `, statusDte=`"& recentdate &"` where ReferenceNO IN (" & intdelitem &")"
rsapproveLOA.Open sqlXDel1, conn
end if
if i click the submit button it will display a pop up with a textarea and i will input the reason why i disapprove and click the button and close the pop up.
the values from textarea will update the table LOAForms
How is that?
Pls help..
thanks,
arazia
|
|
|
If I understand correct, you have a page with a form. This page pops up a window. You want the popup window to update the form on the parent window?
In Javascript in the popup window:
self.opener.forms[0].someElementName.value = document.forms[0].myTextArea.value;
By prefixing your object with "self.opener." you reference objects on the parent window instead of the current window.
After your action to update the parent form, perhaps you want to auto close the popup. You can add this line to the end of your javascript function:
self.close();
|
|
|
|
|
can you give me the complete script for that? because i dont know where to start..
thanks,
diego
|
|
|
Complete script? You asked for it--here it is.
First file. Name this "test.html".
-------------------------------------------
<html>
<head>
<title>Example code from Troy Wolf</title>
<script language=javascript>
function GetReason() {
var winWidth = 300;
var winHeight = 300;
var winLeft = (screen.width-winWidth)/2;
var winTop = (screen.height-winHeight)/2;
win1 = window.open("reason.html", "Reason", +
"menubar=0,toolbar=0,resizable=1,scrollbars=0" +
",width=" + winWidth + ",height=" + winHeight +
",top="+winTop+",left="+winLeft);
}
function SetReason(reasonText) {
document.forms[0].value = reasonText;
document.forms[0].submit();
}
</script>
</head>
<body>
When you click the button, a small popup window will be centered in your screen.
When you submit the popup window, the value from the textarea will be passed into
a hidden element on this page. Then this page will automatically submit.
<p>
<form onsubmit="return false" action="/forum/2nd.html" method="post">
<input type=hidden name=reasonText>
<input type=button name="btntype" value="Disapprove Leave" onclick="GetReason()">
</form>
</body>
</html>
-------------------------------------------
Here is the code for the popup window. Name this file "reason.html".
-------------------------------------------
<html>
<head>
<title>Example code from Troy Wolf</title>
<script language=javascript>
function SubmitReason() {
self.opener.SetReason(document.forms[0].reasonText.value);
self.close();
}
</script>
</head>
<body onload=self.focus()>
<form>
<textarea name=reasonText cols=30 rows=10>Enter your reason for denial here.</textarea>
<br><input type=button value="Submit" onclick="SubmitReason()">
</form>
</body>
</html>
-------------------------------------------
Save these two files in the same folder, then run test.html. This is tested and working code to accomplish your goal. You of course need to add in your content, but the scripting for the popup and the auto-submission are in place.
|
|
|
|
|
Ooops. I said tested and working...but I`m so silly. I was just kidding. Change this line:
document.forms[0].value = reasonText;
To this:
document.forms[0].reasonText.value = reasonText;
If you notice any other problems or need further help, reply back here.
|
|
|
|
|
Hi, i was just looking for this code, i need to do few changes, instead of a passing a single value from a textarea, how do i pass multiple selected values from a list box, to the parent window text field. any idea, i changed the textarea into a listbox, but only one selection is passed into the parent field, i wanted to pass multiple values which is seperated by a comma value. is it possible? i need a quick response..
|
|
|
|
|
|
|
// |