Marcello said:
Thank you very much, Thomas.
You are welcome.
It was a long and egsaustive help. Nevertheless, it seems it
still doesn't work.
The main problem is that you do not call the method correctly
because you have not understood what it is doing exactly. You
should read more on JavaScript and DOM(s) before you continue
programming.
At the moment my menu.php is
<?php
Server-side script code is not useful for analyzing its client-side
consequences. Post what the client gets instead, *after* the PHP
Hypertext Preprocessor has replaced it.
[...]
<form action="" onsubmit="selAut(this)">
selAut(...), as it was rewritten by me, requires a reference to an
HTMLSelectElement object, not a HTMLFormElement object, as first
argument. So it must fail on
| if (!o
| || !o.options
here because an HTMLFormElement object referenced in the event handler of
the *form* element with `this' does not have a `options' property which
causes the `if' statement to evaluate to `true' and
| return false;
to execute with which the function is left.
Thus you need to use this.elements['autore'] instead of `this' *there*.
(upper case in the previous message was mine, just for emphasis).
Better to use *bold*, /italic/ and/or _underlined_ instead. Good
NetNews clients even format the text on display as described above.
yes but how can i do that?
<form action="alternative.php" ... onsubmit="return selAut(this)" ...>
The event fires when the user clicks the submit button of the form and if
client-side JavaScript is supported it is then handled.[1] Because the
return value of the method is returned to the event handler, it is possible
to cancel the submit event, meaning that the UA will continue as if the
submit button was not pushed in the first place and thus ignoring the
`action' attribute. So either the method returns `false' always (currently
it only returns `false' on failure) or you leave it as is and use
<form
action="alternative.php"
...
onsubmit="selAut(this); return false;"
...
instead.
In either case, without JavaScript the UA will ignore the event handler and
use the `action' attribute to access a resource that is passed the input
data. You then can also use the `target' attribute to specify the name of
the window where the submit result should be displayed.
Maybe you already know the following:
There are two request methods available: GET and POST. GET, which is the
default, appends the data to the URI of the resource to be accessed like
`?name=value&name2=value2...'.[2] With POST, defined by `method="post"
for a `form' element, the URI remains unchanged but the form data is
included in the body of the HTTP request. Because of that, the latter is
suited for the transmission of extensive and/or sensitive information (the
submitted data is not stored in the history of the user as URL and the
limitations of length UAs and servers impose on URIs do not apply.) Having
PHP available, you can retrieve either information by the $_GET and $_POST
superglobal arrays, the $HTTP_GET_VARS and $HTTP_POST_VARS arrays or, with
the discouraged register_globals=on even with $name. (See the PHP manual for
details.)
HTH
PointedEars
___________
[1]
Define the default scripting language used for event handler code with
<meta http-equiv="Content-Script-Type" content="text/javascript">
within the `head' element.
[2]
Note that with JavaScript manipulating the `location' property, GET is used,
too. To let the UA perform a POST request initiated by JavaScript code, you
need either need to call the submit() method of a POST form after
manipulating its data or use advanced techniques like e.g. XMLHTTPRequest.
Google is your friend. [psf 6.1]