This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes HTML, CSS and JavaScript and the fly likes Shadowing properties, how to access? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Shadowing properties, how to access?" Watch "Shadowing properties, how to access?" New topic
Author

Shadowing properties, how to access?

D Rog
Ranch Hand

Joined: Feb 07, 2004
Posts: 472

Sorry, I have already asked but forgot a solution. I have a form with field action. How can I get actual action property of a from (not field).


Retire your iPod and start with HD Android music player Kamerton | Minimal J2EE container is here | Light weight full J2EE stack | and build tool | Co-author of "Windows programming in Turbo Pascal"
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Get
var myAction = document.formName.action;
Set
document.formName.action = "foo";

Eric
D Rog
Ranch Hand

Joined: Feb 07, 2004
Posts: 472

It doesn't work for me, if a form already has field named as action.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61092
    
  66

Ah, I see what's you're doing now.

The simple answer is, of course, don't name an input element action; or onsubmit, or name, or any other identifier that is already in use as a property of the form element.

Doing so masks the form element property of the same name.

I know of no way to address the actual property of the form once you've masked it with an input element of the same name.
[ February 24, 2007: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
D Rog
Ranch Hand

Joined: Feb 07, 2004
Posts: 472

I use a certain framework which automatically generates form based on database schema and provides all data exchange. It seems it needs some improvement to care additional mapping when schema names conflicting with form reserved word properties. Any ideas what it can be? for example addin '__' to name or !! something definetly can't be allowed to database schemas to avoid new conflicts.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61092
    
  66

The set of properties for the form element is pretty small (see here) so it shouldn't be a problem to rename any schema elements to avoid these names.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Shadowing properties, how to access?