Wednesday, February 26, 2014

Question about cakephp forms and JS

Hi,

I am trying to make a form which collects data on submit. Maybe someone can help me.

I have a  <canvas id="canvas">

Then I have a form:

<?php
echo $this->Form->create('Drawing');
echo $this->Form->input('id');
echo $this->Form->input('name');
echo $this->Form->input('description');
echo $this->Form->input('canvas');
echo $this->Form->end(__('Submit'));
?>

When the user clicks submit, I want the page to collect the canvas data, and send it along with the rest of the post data.

How would I do this?

var canvas = document.getElementById('canvas');
var dataURL = canvas.toDataURL();

Also after submit I would like to store it. Normally I use the upload plugin from Jose gonzalez, but not sure if it can handle the raw data. So maybe I need save it first to the server. This will not be a problem. The main problem is how I can get the dataURL into the forms canvas. 

Greets,
Thomas


--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: