Kompx.com or Compmiscellanea.com

JavaScript form submit

Windows : Internet Explorer 4.01+, Firefox 1.0+, Google Chrome, Opera 3.0+, Safari 3.1+, SeaMonkey 1.0+ [ 1 ].

Linux : Firefox 1.0+, Google Chrome / Chromium, Opera 5.0+, SeaMonkey 1.0+ [ 2 ].

Submitting a form using JavaScript. A dropdown list (form + select + multiple options) is processed without any submit button. Example:


<form action="action.php" method="post">

<select name="page" required="required" onchange="this.form.submit()">

<option value="" selected="selected" disabled="disabled"> --- Select a page --- </option>

<option value="http://www.kompx.com/en/os/linux-1.htm">Linux</option>

<option value="http://www.kompx.com/en/os/windows-1.htm">Windows</option>

<option value="http://www.kompx.com/en/os/dos-1.htm">DOS</option>


<noscript><input type="submit" value="Submit" /></noscript>


When an option has been chosen from the dropdown list, the form's state is changed. So the onchange event occurs and JavaScript code in onchange is executed: the process of the form submission in started by the script, not by clicking submit button which is absent.

Some server-side script [ 3 ] is meant then to handle the form action. The script is supposed to get what the form sends and have it processed. A PHP script in action.php is used in the example:


if (isset($_POST["page"])) {

    header("Location: $_POST[page]");


} else {

    echo "No options selected";


$_POST is an array of variables passed to the current script via the HTTP POST method. So $_POST[page] contains the content of the value attribute in a select option. That is, a URL. It is passed from form to PHP script and the script redirects browser to the URL / page selected.

HTML code of <noscript><input type="submit" value="Submit" /></noscript> is present in the form as a fallback in case JavaScript happens to be turned off. Then there is a submit button to appear and the form is usable anyway.

[ 1 ]

As well as Netscape 3.04+, Mozilla 0.6+.

[ 2 ]

As well as Netscape 3.04+, Mozilla 0.6+.

[ 3 ]

If a CMS is used, form action may be handled by some of its inbuilt means.

Aliosque subditos et thema

Renaming files in DOS

Renaming files in DOS by REN command REN FILE1.TXT FILE2.TXT - Renames FILE1.TXT into FILE2.TXT REN FILE1.TXT FILE2.HTM - Renames FILE1.TXT into FILE2.HTM REN *.TXT *.HTM - Renames all files with .txt extension into files with .htm extension. Only extensions are changed, the file names proper are left as they were. Since REN is the shorter form of RENAME command, RENAME may be used instead - as more self-explaining may be. Renaming files in DOS by MOVE command MOVE FILE1.TXT FILE2.TXT - Renames FILE1.TXT into FILE2.TXT MOVE FILE1.TXT FILE2.HTM - Renames FILE1.TXT into FILE2.HTM Both methods of file renaming work in Windows command prompt as well. But there is a certain distinction: MS-DOS, other typical / older DOS'es, command prompt of Windows prior to Windows 95 and Windows NT 3.51 use a short filename / 8.3 filename convention. So, for example, REN FILE1.HTM FILE1.HTML is not going to work, there will be "Duplicate file name or file name not found" message. And that is not the case with newer DOS'es or command prompt of newer Windows. It can be not the case in older DOS'es also - if relevant drivers are installed. [ 1 ] MS-DOS 6.0+ tested - but it also may happen to work well under other versions of MS-DOS or other DOS'es.

Renaming folders in mc

Renaming a folder in mc / Midnight Commander: - Select a folder --> Shift - F6 --> Edit existing folder name into a new one --> Enter Select a folder Edit folder name The original way of renaming a folder - the one mc / Midnight Commander had before "Shift - F6" was implemented - is also still there: - Select a folder --> F6 --> Enter a new folder name --> Enter Select a folder Enter folder name And "Esc - 6" may be used instead of "F6": - Select a file --> Esc - 6 --> Enter a new folder name --> Enter Select a folder Enter folder name