You are viewing limited content. For full access, please sign in.

Question

Question

how to force the camera?

asked on September 11, 2018 Show version history

Hi all!

In my Web Form, I'm using the tool "Downloading Files" to get some pictures.

This Form is used by a smartphone BUT without Laserfiche app ; we are using default navigator.

 

Each time we are trying to import picture, the navigator ask to us if we want to open the camera or the library.

Is it possible to select the camera by default?

 

In the web, I found this code :

<input type="file" accept="image/*;capture=camera">

How can I use it in the form?

 

Thanks in advance.

Regards

0 0

Answer

SELECTED ANSWER
replied on September 12, 2018

Ok I found it.

My syntaxe was bad, this is what We need.

 

    $('#q32 input').attr('accept','image/*');
  	$('#q32 input').attr('capture','user');

It's working now.

Thank you.

1 0

Replies

replied on September 12, 2018 Show version history

You might be able to use JavaScript in the $(document).ready() event to update the "accept" attribute.

For example, you could try something like this (haven't tested it myself).

$(document).ready(function(){
    $('YourInputField').attr('capture','camera');
});

EDIT: Updated with the more current HTML attribute.

1 0
replied on September 12, 2018

Hi Jason,

 

Thank you for the help but your solution doesn't work.

I tried

$('#Field32').attr('accept','image/*;capture=camera');
$('#Field32').prop('accept','image/*;capture=camera');
$('#q32').attr('accept','image/*;capture=camera');
$('#q32').prop('accept','image/*;capture=camera');

but the form still ask me if I want to open the camera or the library.

0 0
SELECTED ANSWER
replied on September 12, 2018

Ok I found it.

My syntaxe was bad, this is what We need.

 

    $('#q32 input').attr('accept','image/*');
  	$('#q32 input').attr('capture','user');

It's working now.

Thank you.

1 0
replied on September 12, 2018

I just tested and got similar results. I used the following to get it working:

.attr('capture','camera');

 

1 0
replied on May 3, 2019

How do you list all the optional attributes for the fields in forms?

0 0
replied on May 3, 2019

These are just HTML5 attributes, not necessarily "Forms" attributes.

0 0
replied on May 3, 2019

Ok, I went down a rabbit hole searching Google on this attribute. First everyone says that the only 2 options are "user" and "enviornment", that "camera" is not supported. 

I tried over and over the code that worked for both of you, but it just doesn't seem to work in iOS 12. Maybe it was something that existed in previous operating systems?

In the end to get it to open the camera I had to modify it this way, so that capture is a blank attribute and the class name has been removed. If you do not remove the class name, adding the capture attribute does nothing.

<input type="file" accept="*" title="Upload" multiple="multiple" id="Field2" name="Field2" org="2" class="" data-parsley-file-size="250" data-parsley-valid-file="true" data-parsley-validate-if-empty="true" style="position: absolute; left: 0px; top: 0px; opacity: 0; height: 26px; width: 5px;" capture="">

 

0 0
replied on May 3, 2019

That was one of the ones I was looking at. It needs a value of user, environment or blank. But I feel like the prompt we are trying to bypass is a LF specific prompt that is in their app, it is not the same one that this attribute bypasses. I missed from the OP that this was regarding using a web browser on the phone, when we are using the LF app.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.