Brain Flush

December 30, 2007

Ubuntu Linux on a Samsung R55 Notebook

Filed under: Hardware & Technology, Linux & Open Source — Tags: , , , — Matthias @ 1:24 pm

In an attempt of shameless self-promotion, I’d like to point out my website covering the installation and potential issues of running Ubuntu Linux on Samsung’s R55 notebook series.

http://www.infodump.de/samsung-r55-linux

It focuses on an older version of Ubuntu, but I will update it once the next LTS release of Ubuntu hits the server somewhere around April 2008.

Advertisements

December 8, 2007

Defining default buttons in HTML forms using JavaScript

Filed under: Software Development & Programming — Tags: , , , — Matthias @ 1:23 pm

Being a keyboard junky myself, I recently stumbled over the somewhat annoying fact that it seems to be impossible to explicitly tell a web browser what the default button in an HTML form is, i.e. which button will be activated when the user hits the ENTER key. I suspected some kind of “default” attribute to be set on a button, but nada, there simply is no such thing. The default button of an HTML form is always the “submit” button.

This is pretty useless for AJAX applications, where you typically do not want to submit the form by evaluating the action parameter of the form, but instead want to trigger an asynchronous request that carries the data of the form. The obvious solution is to exploit the action parameter of the surrounding form: Instead of providing a server URL, you simply execute the click-handler of the button you want to be the default button:

<script type="text/javascript">
    function sendForm() {
        alert ("sending data");
    }
</script>
<form id="MyForm" action="javascript:sendForm()">
   <input type="text" size="50" name="myParam"/>
   <input type="button" name="myButton" value="Send"
        onclick="sendForm()"/>
</form>

Whenever the user hits the ENTER key, the button’s click-handler is invoked. Technically, no actual click event is fired of course. But it does the job.

Blog at WordPress.com.