1 Reply Latest reply on Jul 11, 2012 7:33 AM by Efren ONeill

    Taking a simple picture

      I am new to RhoStudio and have found the documentation confusing and lacking.  I hope the problem is that I do not understand how to use it.

       

      Anyways, I am trying to simply provide a link to the user so he can take a picture and show this picture on the view.  I am working with an Android the device.  I understand that pictures can only be taken from Ruby, so I created a controller holding an action which will take the picture.  In my view, I placed a link like the one below:

      <a id="lnkTakePicture" href="javascript:take_picture();">Take a picture</a>

       

      The following script is placed at the top of the view where the link is declared.

      <script type="text/javascript">

        function take_picture() {

          $.get('/app/Utils/take_picture', {});

        }

      </script>

       

      The controller UtilsController is declared and has action take_picture defined.

       

      As expected, the link is shown correctly.  However, when I click on the link, the Web Inspector shows the message "Can't find variable: take_picture".

       

      Is there a reason for the view not to recognize take_picture as a function rather than a variable?

        • Re: Taking a simple picture

          Found the problem.  The <script> block must be declared inside

          <div data-role="page"></div>

           

          I work with ASP.NET MVC and a <script> block can be declare anywhere in the view.  This is what caused my confusion.

           

          Again, bad documentation.  I pretty much had to guess what was happening.