Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

html+css+jQuery+php - typical 'no screen refresh' contact form issue ? 2

Status
Not open for further replies.

c0deM0nK424

Programmer
Oct 28, 2007
126
GB
alright guys. Heres whats going on. I have used this tutorial basicaly I've utilised this chaps script and files and got the form to submit - i can pick up the emails on my htc phone quite nicely when i send via the form on this site:


I omitted the css styles from his tutorial and kept it simple to begin with - i think that might have caused a problem.


inside public_html I have two directories, manoj-kumar.co.uk and mr-manoj-kumar.co.uk

im using the first directory (domain) as u can see.

then ive created a folder called LSG inside manoj-kumar.co.uk and the LSG pages are in there.

to cut a long story short - when submitting the form, i end up seeing the error/success messages on the php file itself.

try it yourselves and see. What am I doing wrong or not doing, which is causing the php page to appear with the messages instead of remaining hidden ?

is it due to the lack of styling on the form i have ? i.e no spaces between text fields (where the errors will appear if field is left blank) ?

or is it because the processform.php page is in the wrong folder ?

ive placed it in the cgi-bin and referenced it that way but it didnt change anything.

also its now in the manoj-kumar.co.uk directly itself, prior to this it was in the LSG directly. Either of those two , still worked.

is the processphp page appearing cos ive not styled the form correctly ?

Here is this guys form in action - on my server, Ive managed to get his form working fine - applied the logic to my own form on and you can see it doesnt quite work. Well it works but it doesnt hide the php page, which defeats the purpose of 'no screen refresh'.

any tips advice of where im going wrong ?
 
well --- first off your page is an htm extension which is not by default processed by php. and your page is not being processed for sure as an examination of the page's source code shows the php.

so perhaps a good idea to rename it with a .php extension

also, run the page in firefox with firebug showing. you will see that there are a large number of page resources that are failing. and even if they were not failing you are loading the same resources multiple times. which won't be good for the page functionality.

so because the form js is never being loaded, it is not handling the send-button press. so what you are seeing is a normal http page GET request.

fix the references.
The requested URL /manoj-kumar/LSG/js/contact.js was not found on this server
I think the script imports should be perhaps
Code:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js" type="text/javascript"></script>
[COLOR=#F57900][s]<script type="text/javascript" src="js/jquery.min.js"></script>[/s][/color]
<script type="text/javascript" src="[COLOR=#F57900]../js/[/color]jquery.validate.min.js"></script>
<script type="text/javascript" src="[COLOR=#F57900]../js[/color]/jquery.form.js"></script>
<script type="text/javascript" src="[COLOR=#F57900]../js[/color]/contact.js"></script>
<script>
and perhaps all will be well?
 
jpadie i don't think that would have solved the problem lol

Also the form does work - i.e error validation etc works, however isn't the processform.php file meant to processed in the background ?

like on here : - try leaving one or more fields blank and hit submit - error validation and error message output works sweetly lol

but yeah, it appears i can't get this to work on the form for h - notice error validation works, form submits but the response messages (errors or success) show up as a php page itself , which should get processed behidn the scenes.

i took bits off and changed css styles otherwise its still the same thing as contact.html , contact_us.html was my own experimenting with the styling.


well damn - im stumped lol - anyone know whats going on here ?

im sure its got something to do with the LSG folder ... and that if i created it under master folder 'manoj-kumar.co.uk' then that would work. Im gonna try it now :)

brb - in mean time feel free to reply to this thread tek-heads.
 
really? none of it worked for me as the resources were not being loaded. no js script, no functionality.
 
in the first link, everything works because the resources are being loaded.

try using the script blocks I provided and see whether it makes a difference.
 
Screen%20Shot%202013-09-15%20at%2019.29.31.png
 
I agree with jpadie. The reason its not working in the second link is because the JS is not being loaded and as such the form gets naturally submitted to the PHP script rather than getting intercepted by the JS and sent to the php page via ajax to get processed in the "background".

Basically you need to fix your paths to the JS libraries you are including so it works as expected.







----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech
 
all i did was remove that line that you hvae striked out above jpadie.

then i did a refresh and tried again. the processform.php page comes up still.

let me try again.
 
THANKS VACUNITA and Jpadie - i realise my mistake now. I will fix this now. Thanks again.

 
i did highlight the relevant bits of the other lines in red too!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top