I am working with Zendframework 1.
On my view page, I used a JavaScript function *(JavaScript base64 encoder)*to encode some values: the function encrypts data that is transferred from one application to another.
I then want to send those value via a form to a method held within my controller. All of this should, in theory work fine.
My problem is this: once the value is received within my controller, I then need to decode it. So, I obviously need to attach a JavaScript function within my method that will enable me to then decode the information received.
Perhaps it might be easier if I show you what I am trying to achieve.
The form values with the enclosed values
<form action="#" method="post">
<textarea name="txtstr" id="txtstr" cols="26" rows="5" Value="dGhlIGVuY2xvc2VkIHZhbHVlcyA=" ></textarea>
<submit id="btnencode64">Encode</button><br/><br/>
</form>
The script for encoding the values
<script src="<?= $this->baseUrl() ?>/js/baseSixtyFourEncoder.js" type="text/javascript"></script>
The method within a controller
public function ppAction()
{
$text = base64_decode($this->getRequest()->getParam('txtstr'));
}
The issue now really is that I need to be able to use the JavaScript function once the form is received at the ppAction().
Is it possible to use the JavaScript function in this way. I realise that PHP and JavaScript cannot really be used at the same time. But is it possible to use JavaScript in this contact?