We are using the Aheadworks Helpdesk Module and are trying to create a second form to capture specific information and use the form to create a ticket where all of the form content gets posted to the "content" section of Helpdesk.
The problem is, if I use the name="content", what gets posted into the "content" section is simply "Array"
The form code is quite simple:
<form id="helpdesk-ticket-form" action="../helpdeskultimate/customer/new/" method="post" enctype="multipart/form-data"><input name="title" value="WHOLESALE SETUP REQUEST" type="hidden">
<div><label for="title_field">Name<span class="required">*</span></label><br> <input id="title" class="input-text required-entry" style="width: 250px;" name="" value="" type="text"></div>
<div> </div>
<div><label for="title_field">Company Name<span class="required">*</span></label> <br><input id="content_field" class="input-text " title="Company" name="content" value="" type="text"></div>
<input name="department_id" value="2" type="hidden">
<div> </div>
<div><label for="content_field">Message<span class="required">*</span></label><br> <textarea id="content_field" class="required-entry" style="width: 450px;" name="content" rows="10" cols="53"></textarea></div>
<div> </div>
<div> </div>
<div><label for="filename">Attach Reseller Permit (2Mb limit)</label><br> <input id="filename" class="input-file" style="width: 450px;" name="filename" type="file"></div>
<div class="button-set"> </div>
<div class="button-set"><span><span><br></span></span></div>
<div class="button-set"><button class="button right form-button" type="submit"><span> <span>Submit ticket</span></span> </button></div>
</form>
I have tried using name="content[]" but it also returned "Array"
The module looks to be using this post method:
public function newAction()
{
if (!$this->_getCustomerSession()->getCustomerId()) {
$this->_getCustomerSession()->authenticate($this);
return;
}
$session = Mage::getSingleton('core/session');
$customer = $this->_getCustomerSession()->getCustomer();
$Proto = Mage::getModel('helpdeskultimate/proto');
$postData = $this->getRequest()->getPost();
if (isset($postData['department_id'])) {
$Proto->setDepartmentId($postData['department_id']);
}
try {
$Proto
->setSubject(@$postData['title'])
->setContent(@$postData['content'])
->setPriority(@$postData['priority'])
->setStoreId(Mage::app()->getStore()->getId())
->setFrom(Mage::getSingleton('customer/customer')->getId())
->setSource('web');
The insert into the message field seems to come from here:
/* Insert */
try {
$message->setContent(trim($data['content']));
$validateResult = $message->validate();
The full controller file can be downloaded from http://www.gingabox.com/CustomerController.zip
I am not sure how to actually use a foreach statement with the @$postData['content'], or if there is a better solution.
I would happily ask AheadWorks, but have been told by them that they are not accepting customization inquiries at this time (too busy)...
Any help would be greatly appreciated!
$this->getRequest()->getPost();retrieves all of the post data in a single array, does$this->getRequest()->getPost('content');also return just the type?$postData = $this->getRequest()->getPost();to$postData = $this->getRequest()->getPost('content');This however causes the ticket to not post any of the input values and returns an error.$this->getRequest()->getParam('content'). Failing all else, have you tried$_POST['content']?$this->getRequest()->getParam('content')returns an error (missing input data error)$_POST['content']posts "Array" I also tried adding$_POST = $this->getRequest()->getPost('content');to the compliment$_POST['content']and it also gets a missing input error.