0

I'm working on a new Joomla 2.5 site running under XAMPP. I have written a custom estimating form in HTML as an Article.... A jQuery file for calc's and a contact.php file to email all calc's and client info.

As for using a form plug-in I don't think this is possible because of all of the calculations ... sliders ect. going on.

The problem is when I hit the submit button, joomla can't seem to find the contact.php file. I am running XAMPP and have located the contact.php file in the root of my project.

Here's the link to my Article with the form

http://localhost/cleardraft/index.php/hosting/2012-02-17-02-08-39/estimate

Link which is being returned that can't be found when clicking the Submit button. I was not expecting a link like this to the contact.php file

http://localhost/cleardraft/index.php/hosting/2012-02-17-02-08-39/contact.php

Sample of HTML

<form id="wizard-form" method="post" action="contact.php" class="jWizard">

 <!------normal form code stuff here----->

<button type="submit" class="button-finish" style="display: inline-block; ">Submit</button>

I have searched and searched but have found no answers online.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Richard Max
  • 53
  • 2
  • 9
  • Depending on your settings, Joomla may be doing a URL rewrite... what happens if you set your action to the file directly like: action="http://localhost/cleardraft/contact.php" assuming thats the file location... make sure to include the http:// before it... stack overflow is not showing that and i'm on my mobile – Jeff Wooden Aug 10 '12 at 05:57
  • Thanks for your response Jeffery. I just tried doing a direct route as you suggested. I also tried ../cleardraft/contact.php but no luck. As for the 404 not found message its still showing the path as http://localhost/cleardraft/index.php/hosting/2012-02-17-02-08-39/contact.php – Richard Max Aug 10 '12 at 06:19
  • Lets say for instance that you created a test.php file in your root with a simple html contents of 'test'.... when you access localhost/cleardraft/test.php from your browser, do u get any ouput? – Jeff Wooden Aug 10 '12 at 06:25
  • I navigated to the root of cleardraft with firefox and clicked on phpTest.php it opened and displayed the HTML content as it should. – Richard Max Aug 10 '12 at 06:34
  • 1
    my guess is that you have an .htaccess file that is causing the issues... what happens if you throw a simple form submit into your phpTest.php file and post it to a phpTestSubmit.php file? Does it route correctly? – Jeff Wooden Aug 10 '12 at 06:40
  • K did the test as stated above...this is the error Chrome reported...XMLHttpRequest cannot load file:///C:/xampp/htdocs/cleardraft/contact.php. Origin null is not allowed by Access-Control-Allow-Origin. – Richard Max Aug 10 '12 at 06:55
  • check out this post: http://stackoverflow.com/questions/10143093/origin-is-not-allowed-by-access-control-allow-origin – Jeff Wooden Aug 10 '12 at 07:04
  • I run xampp on localhost as well... you may have to set some config in your vhosts file for that direcotry... what version of xampp r u running? – Jeff Wooden Aug 10 '12 at 07:09
  • Thanks Jeffery .... even if disabling Access-Control-Allow-Origin worked it still wont solve the problem. I'm still looking for clues on google... – Richard Max Aug 10 '12 at 07:36
  • I never set this particular sight as a Vhost in xampp .. That could be it though...I think I will just upload what I have to the shared server and see if it behaves the same. By the way...Very nice website you have...Are you the owner? – Richard Max Aug 10 '12 at 07:43
  • Hey richard, try to setup a vhosts entry and see what happens, btw, I am one of two owners – Jeff Wooden Aug 10 '12 at 14:34
  • try using `` for the post – Lodder Aug 10 '12 at 15:12
  • I have solved the Problem.... will post answer to the problem tomorrow – Richard Max Aug 12 '12 at 08:38

1 Answers1

1

(Solved by the OP in a question edit. Moved to a community wiki answer. See Question with no answers, but issue solved in the comments (or extended in chat) )

The OP wrote:

Solved... * Solved... * Solved...

<form id="wizard-form" method="post" action="http://localhost/cleardraft/contact.php" class="jWizard"> <--Direct Path Here.

This is was hanging out at the bottom of my HTML file! Totally forgot about!!!!!! this was the cause of my headache!!!

$('form#wizard-form').bind('submit', function() {
    $('.R_C_loader').show();
    $.post("http://localhost/cleardraft/contact.php", <--Direct Path here and Solved it.
           $("#wizard-form").serialize(), 

           function(reply) {
               $(".R_C_message, #R_C_TopMessage").removeClass().html(reply);
               $('.R_C_loader').hide();
           });

    return false;

});
Community
  • 1
  • 1
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129