473,396 Members | 1,997 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Problem on Safari version 1.0.3

I have the following code in my page:

function formSubmit(next){
document.forms[0].button.value = next;
document.forms[0].userAgent.value = navigator.userAgent;
document.forms[0].submit();
}
When I hit the submit button which runs this code none of the form
fields are populated. when I try to pull them out in my Java code they
are empty. Any idaes? Thanks.

Mar 10 '06 #1
5 2525
Thought I'd add that this works on safari versions 1.3.1 thru 3 and
2.0.1.

Mar 10 '06 #2
vikesfan wrote:
I have the following code in my page:

function formSubmit(next){
document.forms[0].button.value = next;
document.forms[0].userAgent.value = navigator.userAgent;
document.forms[0].submit();
}
When I hit the submit button which runs this code none of the form
fields are populated. [...]


"Does not work" is a useless error description. [psf 4.11]

Read the FAQ, especially <URL:http://jibbering.com/faq/#FAQ4_43> and
try the standards compliant approach:

document.forms[0].elements['button'].value = next;
document.forms[0].elements['userAgent'].value = navigator.userAgent;

It also is highly likely that you have a control named `submit' which
overrides/overwrites the submit() method. In that case you should see a
TypeError exception ("submit is not a function") on the submit() line.
HTH

PointedEars
Mar 11 '06 #3
Thomas 'PointedEars' Lahn said the following on 3/11/2006 5:18 PM:
vikesfan wrote:
I have the following code in my page:

function formSubmit(next){
document.forms[0].button.value = next;
document.forms[0].userAgent.value = navigator.userAgent;
document.forms[0].submit();
}
When I hit the submit button which runs this code none of the form
fields are populated. [...]
"Does not work" is a useless error description. [psf 4.11]


Then it's a good thing he didn't say that then, huh?
Read the FAQ, especially <URL:http://jibbering.com/faq/#FAQ4_43> and
try the standards compliant approach:

document.forms[0].elements['button'].value = next;
document.forms[0].elements['userAgent'].value = navigator.userAgent;


There is nothing more "standards compliant" about what you posted than
what the OP posted. Both are equally "compliant". If want to nit-pick it
into compliance, then don't mix numeric indexes and string indexes:

document.forms['formID'].elements['userAgent'].value;

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Mar 12 '06 #4
Randy Webb <Hi************@aol.com> writes:
Thomas 'PointedEars' Lahn said the following on 3/11/2006 5:18 PM:
vikesfan wrote:
document.forms[0].button.value = next;
document.forms[0].elements['button'].value = next;
There is nothing more "standards compliant" about what you posted than
what the OP posted. Both are equally "compliant".


No need to put "compliant" in quotes[1].

The specification is not entirely clear on this point. There is no
doubt that what Thomas Lahn wrote is only relying on features
standardized by the W3C HTML DOM (even in version 1) ECMAScript
bindings.

There is doubt that the named controls should be made available as
properties of the form element itself, and not just as properties of
the elements collection. Doing so is unnecessary (since the elements
collection is specified) and it is likely to lead to name collisions
between form controls and properties and methods of the form
element. It is, however, what most brosers have done, leading
to the recurring problem of "form.submit() doesn't work .. oh, the
submit button is named 'submit'".

/L
[1] Damn, now I did it!
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Mar 12 '06 #5
Lasse Reichstein Nielsen wrote:
Randy Webb <Hi************@aol.com> writes:
Thomas 'PointedEars' Lahn said the following on 3/11/2006 5:18 PM:
vikesfan wrote:
document.forms[0].button.value = next;
document.forms[0].elements['button'].value = next;

There is nothing more "standards compliant" about what you posted than
what the OP posted. Both are equally "compliant".


No need to put "compliant" in quotes[1].

The specification is not entirely clear on this point.


It is. The HTMLFormElement interface provides no `button' property, for
example. So that property would not be part of that Web standard, but
proprietary; a proprietary extension, if you will.
PointedEars
Mar 12 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Josh Renaud | last post by:
I'm working on a site and ran into a little trouble with Safari. Here are the relevant links: page: http://www.joshrenaud.com/fredbear/contact.html css: ...
2
by: jdlwright | last post by:
Hi, I have a big script that doesn't work in Safari 1.3, but does work in FF, and IE. I've given up going to my local Uni. to use their Macs (they've prevented the Debug menu from appearing...
4
by: Paul W | last post by:
Hi - can someone point me to info on the issues/resolutions of supporting the safari browser? To help me understand, if I was developing pages in say FrontPage, what attributes would I set for...
1
by: gerry | last post by:
Hi, although this is not strictly asp.net related, I was hoping that someone could confirm or debunk what appears to be a major problem with safari POSTs. with the following html : <!DOCTYPE...
2
by: Martin Honnen | last post by:
I was playing around with canvas support in recent Safari, Mozilla and Opera (only version 9 preview) but run into issues with Safari related to the very old DOM Level 0 Image object for preloading...
34
by: Simon Wigzell | last post by:
document...focus() will scroll the form to move the specified text field into view on everything I have tried it with except Safari on the MAC. The form doesn't move. Any work around? Thanks.
3
by: Jeff Paffett | last post by:
I'm trying to use the onPaste event in a text input, which according to Apple is supported. However, I get no response in Safari. Firefox works fine.
1
by: Bigpond News Server | last post by:
I have built a website that uses frames and a heavy reliance on Java Script to modify framesets, frames and load pages on the fly. The site works fine when using the PC version of Internet...
3
by: Amir Michail | last post by:
Hi, I have bookmarklets with a # in their urls but safari changes the # to %23. And unfortunately, the bookmarklet does not work with %23. You need to change it back manually to #. Any...
1
by: npm | last post by:
Hi I've checked out this page (and it works fine) in FF, IE, Opera, Chrome and Safari: http://www.w3schools.com/dom/tryit.asp?filename=try_dom_list_loop But when I try and tweak it for a site...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.