HighDots Forums  

Form Woes !

JavaScript discussion (multi-lingual) JavaScript discussion (alt.comp.lang.javascript)


Discuss Form Woes ! in the JavaScript discussion (multi-lingual) forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Leon
 
Posts: n/a

Default Form Woes ! - 02-13-2007 , 01:22 PM






Hi Chaps,

I have been looking around the internet and I really can't see what I'm
doing wrong here !

This code works in firefox, but not internet explorer.

Any suggestions please? Internet Explorer just doesnt update the action
of the form so when you hit the button - it seemingly just refrehes the
page!

<form name="actions" action="" method="post">
<select name="action" class="formBox">
<option value="null" onclick="this.form.action.value='';">Select Action
From List
<option value="resendActEmail"
onclick="this.form.action.value='./admin_process.php?a=resend';">Re-Send
Activation Email
<option value="deletaccount"
onclick="this.form.action.value='./admin_process.php?a=delete';">Delete
This Account
</select>
<input class="formBox" type="submit" name="submit" value="Go">
</form>

Thanks,

Leon

Reply With Quote
  #2  
Old   
VK
 
Posts: n/a

Default Re: Form Woes ! - 02-13-2007 , 02:07 PM






On Feb 13, 10:22 pm, Leon <l... (AT) dontcallmeeeore (DOT) co.uk> wrote:
Quote:
Hi Chaps,

I have been looking around the internet and I really can't see what I'm
doing wrong here !

This code works in firefox, but not internet explorer.
IE has a severe name resolution flaw in forms.
btw thanks for remainding - for records I gonna check if this ugliness
was finally fixed in IE7 (1:10 by my estimate :-(

For the time being NEVER EVER name form controls same names as default
attributes and methods of form itself.

As a side comment: onclick listener for option element is not a
documented feature, so some browsers may implement it and some not.
<select onchange="myfunction(this.options[this.selectedIndex].value)"
is the universally supported alternative.

<form name="actions" action="" method="post">
<select name="MyAction" class="formBox">
<option value="null" onclick="this.form.action.value='';">Select
Action From List
<option value="resendActEmail" onclick="this.form.action.value='./
admin_process.php?a=resend';">Re-Send
....
</select>
<input class="formBox" type="submit" name="MySubmit" value="Go">
</form>





Reply With Quote
  #3  
Old   
Leon
 
Posts: n/a

Default Re: Form Woes ! - 02-13-2007 , 02:21 PM



VK wrote:
Quote:
On Feb 13, 10:22 pm, Leon <l... (AT) dontcallmeeeore (DOT) co.uk> wrote:
Hi Chaps,

I have been looking around the internet and I really can't see what I'm
doing wrong here !

This code works in firefox, but not internet explorer.

IE has a severe name resolution flaw in forms.
btw thanks for remainding - for records I gonna check if this ugliness
was finally fixed in IE7 (1:10 by my estimate :-(

For the time being NEVER EVER name form controls same names as default
attributes and methods of form itself.
Yeah - i noticed this already and updated - thanks :-)
Quote:
As a side comment: onclick listener for option element is not a
documented feature, so some browsers may implement it and some not.
select onchange="myfunction(this.options[this.selectedIndex].value)"
is the universally supported alternative.
would i need to make the value of each option equal to the URL i want it
to go to then ?

Eg..

<select name="myselect" action="" method="post"
onchange="myfunction(this.options[this.selectedIndex].value)">

<option value="admin_process.php?a=resend">Resend

</select>

?

Quote:
form name="actions" action="" method="post"
select name="MyAction" class="formBox"
option value="null" onclick="this.form.action.value='';">Select
Action From List
option value="resendActEmail" onclick="this.form.action.value='./
admin_process.php?a=resend';">Re-Send
...
/select
input class="formBox" type="submit" name="MySubmit" value="Go"
/form

Thanks,

Leon


Reply With Quote
  #4  
Old   
VK
 
Posts: n/a

Default Re: Form Woes ! - 02-13-2007 , 02:39 PM



On Feb 13, 11:21 pm, Leon <l... (AT) dontcallmeeeore (DOT) co.uk> wrote:
Quote:
would i need to make the value of each option equal to the URL i want it
to go to then ?

Eg..

select name="myselect" action="" method="post"
onchange="myfunction(this.options[this.selectedIndex].value)"

option value="admin_process.php?a=resend">Resend

/select
Yes. There is an usability impact in either case - because of bias
against keyboard users. On come UAs onchange fired on each scroll
using arrow keys. On other UAs onchange is fired if Enter is pressed
with select having focus. That means that users have to use mouse to
be able to scroll, and still a danger of an "occasional navigation" is
rather high. I'm sure youselve at least once navigated on some site
while simply studying the list of options. IMHO - but yours of decide
of course - "active select" is a sample of intended convenience which
is on practice a big disconvenience. A nice confirmation button near
of "passive select" will require one extra click from your users but
it will save a lot of nerves to them.



Reply With Quote
  #5  
Old   
Leon
 
Posts: n/a

Default Re: Form Woes ! - 02-13-2007 , 02:43 PM



VK wrote:
Quote:
On Feb 13, 11:21 pm, Leon <l... (AT) dontcallmeeeore (DOT) co.uk> wrote:
would i need to make the value of each option equal to the URL i want it
to go to then ?

Eg..

select name="myselect" action="" method="post"
onchange="myfunction(this.options[this.selectedIndex].value)"

option value="admin_process.php?a=resend">Resend

/select

Yes. There is an usability impact in either case - because of bias
against keyboard users. On come UAs onchange fired on each scroll
using arrow keys. On other UAs onchange is fired if Enter is pressed
with select having focus. That means that users have to use mouse to
be able to scroll, and still a danger of an "occasional navigation" is
rather high. I'm sure youselve at least once navigated on some site
while simply studying the list of options. IMHO - but yours of decide
of course - "active select" is a sample of intended convenience which
is on practice a big disconvenience. A nice confirmation button near
of "passive select" will require one extra click from your users but
it will save a lot of nerves to them.

There are only actually 2 users who will be using the select boxes, one
is myself. The problem is - I use Firefox, the other guy uses Internet
Explorer !

I tried to implement your suggestion - with no luck !

<script language="javascript">
function myfunction(gourl) {
document.test.submit.value=gourl;
}

</script>
<form name="test" action="" method="post">
<select name="myselect" action="" method="post"
onchange="myfunction(this.options[this.selectedIndex].value)">

<option value="admin_process.php?a=resend">Resend

</select>
<input class="formBox" type="submit" name="submit" value="Go">
</form>

Leon


Reply With Quote
  #6  
Old   
VK
 
Posts: n/a

Default Re: Form Woes ! - 02-13-2007 , 03:05 PM



On Feb 13, 11:43 pm, Leon <l... (AT) dontcallmeeeore (DOT) co.uk> wrote:
Quote:
I tried to implement your suggestion - with no luck !

script language="javascript"
function myfunction(gourl) {
document.test.submit.value=gourl;

}
submit is method, not a field.

function myfunction(gourl) {
document.forms['test'].action = gourl;
document.forms['test'].submit();
}

On cold turkey I do not remember if all browsers are smart to resolve
the partial URL against the current page URL. In case if make a
complete URL yourself:

function myfunction(gourl) {
document.forms['test'].action = "http://www.foo.bar/" + gourl;
document.forms['test'].submit();
}



Reply With Quote
  #7  
Old   
Leon
 
Posts: n/a

Default Re: Form Woes ! - 02-13-2007 , 03:08 PM



VK wrote:
Quote:
On Feb 13, 11:43 pm, Leon <l... (AT) dontcallmeeeore (DOT) co.uk> wrote:
I tried to implement your suggestion - with no luck !

script language="javascript"
function myfunction(gourl) {
document.test.submit.value=gourl;

}

submit is method, not a field.

function myfunction(gourl) {
document.forms['test'].action = gourl;
document.forms['test'].submit();
}

On cold turkey I do not remember if all browsers are smart to resolve
the partial URL against the current page URL. In case if make a
complete URL yourself:

function myfunction(gourl) {
document.forms['test'].action = "http://www.foo.bar/" + gourl;
document.forms['test'].submit();
}

oops that submit shouldnt have been in there - was just me testing to
see if i could update the submit button value.

I'll give it a go and report !

Thanks,

Leon


Reply With Quote
  #8  
Old   
Randy Webb
 
Posts: n/a

Default Re: Form Woes ! - 02-13-2007 , 03:31 PM



Leon said the following on 2/13/2007 3:43 PM:
Quote:
VK wrote:
On Feb 13, 11:21 pm, Leon <l... (AT) dontcallmeeeore (DOT) co.uk> wrote:
would i need to make the value of each option equal to the URL i want it
to go to then ?

Eg..

select name="myselect" action="" method="post"
onchange="myfunction(this.options[this.selectedIndex].value)"

option value="admin_process.php?a=resend">Resend

/select

Yes. There is an usability impact in either case - because of bias
against keyboard users. On come UAs onchange fired on each scroll
using arrow keys. On other UAs onchange is fired if Enter is pressed
with select having focus. That means that users have to use mouse to
be able to scroll, and still a danger of an "occasional navigation" is
rather high. I'm sure youselve at least once navigated on some site
while simply studying the list of options. IMHO - but yours of decide
of course - "active select" is a sample of intended convenience which
is on practice a big disconvenience. A nice confirmation button near
of "passive select" will require one extra click from your users but
it will save a lot of nerves to them.


There are only actually 2 users who will be using the select boxes, one
is myself. The problem is - I use Firefox, the other guy uses Internet
Explorer !

I tried to implement your suggestion - with no luck !

script language="javascript"
function myfunction(gourl) {
document.test.submit.value=gourl;
}
document.test.action=gourl

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Answer:It destroys the order of the conversation
Question: Why?
Answer: Top-Posting.
Question: Whats the most annoying thing on Usenet?


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.