/    Sign up×
Community /Pin to ProfileBookmark

How do I Know if an input text is visible???

First of all Hello every body, and sorry if my english is not correct.

I work for a little software company and we have a problem, using a tab sheet made with javascript, when we validate a field, if it´s not valid we make an alert and set the focus to the field. This is a very generic function used in all tha aplication.

Well my problem is that if the field is not located in the same tab where you are in the moment of the validation i get a javascript error because the fields on the other tabs are hidden and it says cannot focus to a non visible object.

Anybody can help how could a verify if the field is hidden or visible???

i´ve tried to use this:

if(document.getElementById(‘capa’).style.visibility==’visible’)
·······
······

but this propertie is ” or null wether is visible or not.

Anybody has any idea of how to check if I can make a focus to a field???

Thanks a lot!!!!
Força Barça!

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@sridhar_423Jan 19.2006 — they might be using "display" property instead of "Visibilty". Check the syntax and try it.
Copy linkTweet thisAlerts:
@TheBearMayJan 19.2006 — Why not just set it visible before you transfer focus?
Copy linkTweet thisAlerts:
@ramonibzauthorJan 19.2006 — Thanks sridhar, you were right it was using the display propertie.

bearMay I can´t set it visible or hidden because is a tab control and if i set it visible it will appear in the middle of the screen where i don´t want it, and it´s a public aplication for a quite important company which wouldn´t like this.

But anyways I still have the problem because the hidden object is the parent layer, not the input, so I need to acces to the parent div, only having the input object.

Because i think thisi is another subject I will open another post, so may be can help to more people.
×

Success!

Help @ramonibz spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...