cleanboy3000 Posted September 18, 2019 Share Posted September 18, 2019 So I have a very simple form with just 2 fields that submits on the staging site, tested and got my clients to test and everything was fine. Uploaded exactly the same code to the live site and it works for me but my clients just get the same empty form after submitting instead of the intended thank you message that should be showing in its place...there are no error messages and I can't seem to replicate this anywhere other than on the live site and i don't want to turn debugging mode on there. I have also checked the host for error logs but unfortunately the host doesn't seem to have this feature. How do I debug this or any information as to why it wouldn't be working would be super helpful. I have gotten clients to hard refresh and clear browser cache. They have tried on multiple machines and in different places with the same result. If you would like to take a look the staging site is here: http://ams.staging.gooi.ltd/ It's the Newsletter Sign Up button in the top left. This has been working for everyone that has tried though....like I said...only seems to not work on the live site for some people. This is the form code: <?php $out = ""; $out .= '<h2 class="text-white text-center pusher">SIGN UP FOR THE LATEST NEWS</h2>'; $out .= '<p class="text-white text-italics nomargin">Enter your name and email below:</p>'; // create a new form field (also field wrapper) $sform = $modules->get("InputfieldForm"); $sform->action = "./?modal=newsletter-signup"; $sform->method = "post"; $sform->attr("id+name",'newsletter-signup'); $field = $modules->get("InputfieldText"); $field->skipLabel = true; $field->attr('id+name','newsletter_name'); $field->attr('placeholder','Name'); $field->required = 1; $sform->append($field); // append the field // create email field $field = $modules->get("InputfieldEmail"); $field->skipLabel = true; $field->attr('id+name','newsletter_email'); $field->attr('placeholder','Email'); $field->required = 1; $sform->append($field); // append the field // oh a submit button! $submit = $modules->get("InputfieldSubmit"); $submit->attr("value","Submit"); $submit->attr("class","cta blue pusher"); $submit->attr("id+name","newsletter_submit"); $sform->append($submit); //$out .= $sform->render(); // form was submitted so we process the form if($input->post->newsletter_submit) { // user submitted the form, process it and check for errors $sform->processInput($input->post); if($sform->getErrors()) { // the form is processed and populated // but contains errors $out = $sform->render(); echo $out; } else { $name = $sanitizer->entities($input->post->newsletter_name); $email = $sanitizer->email($sform->get("newsletter_email")->value); $name = explode(' ', $name); $lastName = end($name); unset($name[count($name)-1]); $firstName = join(' ', $name); $mc = $modules->get("SubscribeToMailchimp"); $mc->subscribe($email, ['FNAME' => $firstName, 'LNAME' => $lastName]); $out = "<p class='text-white text-center pusher'>Thank you for signing up to receive the latest news on The Advanced Materials Show.</p>"; echo $out; } } else { // render out form without processing $out .= $sform->render(); echo $out; } ?> Link to comment Share on other sites More sharing options...
bernhard Posted September 18, 2019 Share Posted September 18, 2019 <div class="headshot center-block" style="background-image:url('<br /> <b>Notice</b>: Trying to get property of non-object in <b>/home/drumming/ams.staging.gooi.ltd/site/assets/cache/FileCompiler/site/templates/home.php</b> on line <b>214</b><br /> ');"></div> Not the reason but something I found twice in your code and you might want to fix ? 1 Link to comment Share on other sites More sharing options...
dotnetic Posted September 18, 2019 Share Posted September 18, 2019 Did you fix it? I am getting a success message: First you should install TracyDebugger. If you are logged in as a superuser, it will provide a nice debug bar, which catches and reports errors. Secondly you can look at Setup > Logs. There you have an error and an exceptions log. 1 Link to comment Share on other sites More sharing options...
cleanboy3000 Posted September 19, 2019 Author Share Posted September 19, 2019 Quote Did you fix it? No, it works on the staging site for everyone that has tried it but on the live site it doesnt work, this is the real issue. I gave the staging site just to show the whole thing in action but removed it from the live site because, well, its a live site. This also rules out tracydebugger unfortunately... I have checked the logs in processwire and nothing comes up. Link to comment Share on other sites More sharing options...
Macrura Posted September 19, 2019 Share Posted September 19, 2019 why , i use tracy on all live sites 2 Link to comment Share on other sites More sharing options...
cleanboy3000 Posted September 19, 2019 Author Share Posted September 19, 2019 I thought it always shows a bar at the top? I havent actually properly used it...I'll check it out... Link to comment Share on other sites More sharing options...
gmclelland Posted September 20, 2019 Share Posted September 20, 2019 Go to /processwire/module/edit?name=TracyDebugger edit Tracy's settings: Check this option That way only Superusers can see Tracy on the live site. Hope that helps 3 Link to comment Share on other sites More sharing options...
cleanboy3000 Posted September 23, 2019 Author Share Posted September 23, 2019 Hey, thanks for this...managed to get tracy debugger installed. The really annoying thing about this is that once I install it and activate it and try the form submission...it works. Log out and try again and it fails...super annoying. There is an error that keeps cropping up though: info 2019‑09‑23 18:00:36 https://advancedmaterialsshow.com/ Warning: count(): Parameter must be an array or an object that implements Countable in /path/to/processwire/wire/core/PageArray.php:631 Not really sure if this has anything to do with it or if its anything I can do anything about as it seems to be something to do with the core? Link to comment Share on other sites More sharing options...
gmclelland Posted September 23, 2019 Share Posted September 23, 2019 What version of Processwire are you using? What version of PHP are you using? Older versions of Processwire might not be compatible with the newer versions of PHP 7.X. Link to comment Share on other sites More sharing options...
cleanboy3000 Posted September 24, 2019 Author Share Posted September 24, 2019 ProcessWire 3.0.62 and its PHP 7.3 The odd thing though is that the form submission works when Tracy Debugger is active but then breaks when it is not active...which makes me think its not anything to do with PHP version. Can we learn anything from this? Tracy Debugger must implement something that fixes what I am looking to fix but I have no idea what that is or how to find that out ? Link to comment Share on other sites More sharing options...
bernhard Posted September 24, 2019 Share Posted September 24, 2019 Do you have any kind of caching involved? 1 Link to comment Share on other sites More sharing options...
cleanboy3000 Posted September 24, 2019 Author Share Posted September 24, 2019 Yes...the standard template caching that comes with processwire. If you are looking for the form on the live site and thats why you are asking, as it is a live site I have replaced the button with a link that does work for now. Link to comment Share on other sites More sharing options...
bernhard Posted September 24, 2019 Share Posted September 24, 2019 No, I'm asking because if you are logged in and it works it might be because caching is disabled when logged in. On DEV caching is likely also disabled so that could explain why it works there. Is the not-working form somewhere online to check? 2 Link to comment Share on other sites More sharing options...
cleanboy3000 Posted September 24, 2019 Author Share Posted September 24, 2019 Well thats the wierd thing...it is working everywhere else it is online. (on a staging site) That being said...caching is disabled on that staging site so ill try disable caching and test again. Link to comment Share on other sites More sharing options...
cleanboy3000 Posted September 24, 2019 Author Share Posted September 24, 2019 It looks like caching was the culprate! Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now