Home › Forums › JavaScript › “Contact Us” Div ( Hidden ) shows and hides on page refreshes
- This topic is empty.
-
AuthorPosts
-
February 23, 2011 at 3:07 pm #31749
fjorko
MemberHi All
Very new to Web dev and Jquery in general – in fact I’m a dev noob. I’m Building my first site for experience, and I dearly would love your help with my site. Basically – each time the site loads in IE7/8 my contact us form which is hidden behind my main content opens briefly and closes as soon as the jquery code starts executing that hides this form via a .css() method. It occasionally happens in FF and Chrome as well. I think that jquery is not quick enough to set the css property of the contact us div to 0px in order to hide the form from view before the user sees it.
Please check this with IE and see if you can spot the reason with Firebug please…. any advice is greatly appreciated…
Thank you.
PS. Be kind – it’s my first attempt at this, and I’m not finished yet….. :-)
February 23, 2011 at 4:52 pm #58731Johnnyb
MemberHey there, nice job for a beginner! The problem is that you’re not giving the contact_wrap a height in the css, so it shows the content and then the jquery uses the ‘$(“#contact_wrap”).css(“height”,”0px”);’ to hide it. Try setting the #content_wrap properties to ‘height: 0; overflow: hidden’, initially in the CSS file, and then when you click the ‘Contact Us’ button use $(“#contact_wrap”).animate({height: ‘400px’}, 500); which will expand it to whichever height you like.
February 23, 2011 at 5:25 pm #58725fjorko
MemberJohnny – you’ve just become my new best friend. I think it works !
Can you verify that you do not get the brief “form exposure” anymore ? Can you check from your end on IE, FF and Chrome pls ?
Thanks so much !
February 24, 2011 at 12:15 am #58651fjorko
MemberHow will I validate the form then ? It uses Javascript for that too… so even if I had a separate contact page for non-java users, the form will be “broken” in terms of validation…
I understand your argument though..
February 24, 2011 at 4:06 am #58631TT_Mark
MemberPlease don’t call it ‘java’, because it isn’t.
Validation wise, you should never rely on just JavaScript validation, because if JavaScript is disabled (as any spambot browsing your site will be) then they will bypass your validation and you’ll receive loads of spam. Server-side validation is also key, so do some research into PHP validation
February 24, 2011 at 6:09 am #58590fjorko
MemberSo is it either javascript or php validation ? Which is best ? I assume PHP from the two options ?
I meant Javascript on my previous post, i know there is a difference…
EDIT: Was just thinking – my javascript is doing an AJAX post to a PHP file anyway…if javascript is disabled on the client side – will something like a spambot still be able to spam me without being able to submit to the PHP file that does the actual sending of email…. sorry if i’m being naive – just very new to this as I said before, but really willing to learn the proper way of doing things . . .
February 24, 2011 at 6:24 am #58570TT_Mark
MemberPHP is best, but there is no harm doing both. Relying solely on JavaScript validation is leaving you open to hackers and spambots
February 24, 2011 at 7:03 am #58554fjorko
MemberThanks…now to figure out how to change my form to incorporate both and still validate without a page refresh…
-
AuthorPosts
- The forum ‘JavaScript’ is closed to new topics and replies.