Forum Moderators: open
<html>
<head>
<script LANGUAGE="JavaScript">
<!--
function alertboxRename(FileNameOld)
{
var agree=confirm('Are you sure you want to rename the file "+FileNameOld+' ?');
if (agree)
return true ;
else
return false ;
}
// -->
</script>
</head>
<body>
filename1.txt <a href=?action=rename&file=filename1 onClick="return alertboxRename('filename1.txt')">rename</a>
filename2.txt <a href=?action=rename&file=filename2 onClick="return alertboxRename('filename2.txt')">rename</a>
filename3.txt <a href=?action=rename&file=filename3 onClick="return alertboxRename('filename3.txt')">rename</a>
</body>
+--------------------------------+
| old filename: filename1.txt |
| |
| new filename: |
| +-------------------+ |
| | filename1x.txt | |
| +-------------------+ |
| |
| +----+ +--------+ |
| | OK | | CANCEL | |
| +----+ +--------+ |
+--------------------------------+ Is a REQUEST the way to go, or is this more easy to implement using POST within a form?
The "get" method should be used when the form is idempotent (i.e., causes no side-effects). Many database searches have no visible side-effects and make ideal applications for the "get" method.
If the service associated with the processing of a form causes side effects (for example, if the form modifies a database or subscription to a service), the "post" method should be used.
<script LANGUAGE="JavaScript">
<!--
...
// -->
</script>
<script type="text/javascript">
...
</script>
<form action="" method="post">
<input type="hidden" name="action" value="rename">
<input type="hidden" name="filenameold" value="filename1">
<input name="filenamenew" value="filename1.txt">
<input type="submit" value="Rename">
</form>
<form action="" method="post">
<input type="hidden" name="action" value="rename">
<input type="hidden" name="filenameold" value="filename2">
<input name="filenamenew" value="filename2.txt">
<input type="submit" value="Rename">
</form>