By the way: I would name it "Suggest Category" and maybe add something like $Sender->InformMessage(T('Thanks for your submission!')); so that your user gets a feedback and doesn't send the form multiple times.
Maybe it would be even better to only render the contact form if (!$Sender->Form->IsPostBack())
and don't put styles in your php. <li style="float: none;"><?php echo $this->Form->Label('Additional Info', 'Message').$this->Form->TextBox('Message', array('Multiline' => True))?></li>
use css and classes.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
@vrijvlinder said:
You really should call the plugin something else and if it works , then upload it to the addons as
uploading a one-off plugin to add-ons, that is so esoteric, might be beyond the need. but it would be certainly be better to rename you self-made plugin for your own use. A generic suggestion form e-mail with a sample dropdown, checkbox, radiobutton, and text input might be more suitable, with definitions and translations for each form input.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
@AudioElements said:
hey R_J I don't have this piece of code in my file... it's not in the original file either... where should I put this??
That is because it is in the contact.php the original file
<?php if(!defined('APPLICATION')) die();
// if div has class "AjaxForm" and there is a form in this div, the form will be ajax-posted
$this->AddCssFile('contact.css', 'plugins/Contact');
$this->AddJsFile('jquery.gardenhandleajaxform.js');
?>
<div class="ContactForm AjaxForm">
<?php echo $this->Form->Open()?>
<?php echo $this->Form->Errors()?>
<h1><?php echo T('Contact')?></h1>
<ul>
<li><?php echo $this->Form->Label('Your Name', 'YourName').$this->Form->TextBox('YourName')?></li>
<li><?php echo $this->Form->Label('Your Email', 'YourEmail').$this->Form->TextBox('YourEmail')?></li>
<li><?php echo $this->Form->Label('Message', 'Message').$this->Form->TextBox('Message', array('Multiline' => True)).$this->Form->Label('Check this if You Are Not a Bot').$this->Form->Radio('Checkbox')?></li>
</ul>
<!--<div class="Center"></div>-->
<?php echo $this->Form->Button('Send Message')?>
<?php echo $this->Form->Close()?>
</div>
Hi guys... I switched to the embed friendly theme to see if it was the theme that was the issue... doesn't seem so... when I hit the submit button, the ajax loading image shows up but it just keeps going on and never moves onto the error messages...
i'm thinking that there might be an issue in this part the code... causing an infinite loop
try{
$Email->Send();
}catch(Exception $Exception){
$Sender->Form->AddError(strip_tags($Exception->GetMessage()));
}
if($Sender->Form->ErrorCount() == 0){
$Sender->StatusMessage = T('Thank you for your feedback.');
$Sender->RedirectUrl = Url("/");
}
}
Well I know the plugin works because I use it. Is the email google gmail ? I heard that does not play well...
The error message is only for the fields. Not to let you know something is wrong. If it sends, then you see a message that your email was sent. If no message that email was sent then that is the error. This has to do with your email set up I believe...
You should be able to use the email service from your host provider.
So your email looks like this contact@yoursite.com Just create a special email for this that is sent from inside. Using external mail services does not always work because they block it and don't like to be used as a mail service for websites.
Comments
By the way: I would name it "Suggest Category" and maybe add something like
$Sender->InformMessage(T('Thanks for your submission!'));
so that your user gets a feedback and doesn't send the form multiple times.Maybe it would be even better to only render the contact form if (!$Sender->Form->IsPostBack())
That could be because the message should be enclosed in double quotes I think , also the message only shows if they don't fill it in and try to send.
$Validation->ApplyRule('SubCategory', 'Required',"You must enter a Sub Category. This must be a new category that is not already available.");
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
should be at the top of method, exit before you even begin doing things - if user not logged in
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
and don't put styles in your php.
<li style="float: none;"><?php echo $this->Form->Label('Additional Info', 'Message').$this->Form->TextBox('Message', array('Multiline' => True))?></li>
use css and classes.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
put the contact.css in a Contact/design/contact.css folder in plugin.
change the li sizes in contact.css
various js removed, and simplified.
just exit immediately. no need to test for valid session again in method,
....
change the render to
single vs double quotes in your addrules make absolutely no difference in your context.
move contact.php into Contact/views/contact.php
contact.php
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
You really should call the plugin something else and if it works , then upload it to the addons as
CatChoice
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
uploading a one-off plugin to add-ons, that is so esoteric, might be beyond the need. but it would be certainly be better to rename you self-made plugin for your own use. A generic suggestion form e-mail with a sample dropdown, checkbox, radiobutton, and text input might be more suitable, with definitions and translations for each form input.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
Guitar players generally are ....and unless that is George Benson in his avatar....
That is what Contact plugin is
You can say this CatChoice is an extension of it...
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
hey @R_J I don't have this piece of code in my file... it's not in the original file either... where should I put this??
"Guitar players generally are" @vrijvlinder... LOL!!!
That is because it is in the contact.php the original file
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
http://www.youtube.com/watch?v=IPtv14q9ZDg&spfreload=10%20Message%3A%20JSON%20Parse%20error%3A%20Unexpected%20EOF%20(url%3A%20http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DIPtv14q9ZDg)
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
yea i've got that... thought that was it for a sec... oops
Yes thats ok RJ is not familiar with the plugin an since we only posted the relevant code maybe he thought something was missing... no harm
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
Hi guys... I switched to the embed friendly theme to see if it was the theme that was the issue... doesn't seem so... when I hit the submit button, the ajax loading image shows up but it just keeps going on and never moves onto the error messages...
i'm thinking that there might be an issue in this part the code... causing an infinite loop
tell me what you think...
Did you add the email address in the dashboard ? remember this is sent to the support email you designate.
This should go in the config.php
$Configuration['Garden']['Email']['SupportAddress'] = 'Your email';
$Configuration['Garden']['Email']['SupportName']= 'Name you want email to be addressed to';
might as well add this too if you want html in emails to work
$Configuration['Garden']['Email']['MimeType'] = 'text/html';
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
yes... i did set that email address.
Well I know the plugin works because I use it. Is the email google gmail ? I heard that does not play well...
The error message is only for the fields. Not to let you know something is wrong. If it sends, then you see a message that your email was sent. If no message that email was sent then that is the error. This has to do with your email set up I believe...
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
hmm... ok... it's actually an @outlook.com address... i'll try changing it
You should be able to use the email service from your host provider.
So your email looks like this contact@yoursite.com Just create a special email for this that is sent from inside. Using external mail services does not always work because they block it and don't like to be used as a mail service for websites.
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌