0

I want to open camera and save the picture taken. I don't want to upload saved picture. This can be done using the HTML5 - attribute:

How can I add this capture attribute to my input tag in Contact Form 7 ?

1 Answer 1

1

You can't as of now add it to the tag, you'll need to add a custom file field in your form such as,

<label> Some Text field 
  [text my-text-field] </label>

<label> My image capture 
  <input type='file' id="imgInp" />
  <img id="blah" src="#" alt="your image" /> 
</label>

<script>
//add your custom JS script here
</script>

Note that you will also need some custom JavaScript to render the image, see the link above for more details.

Note also that your custom field will not be parsed by the cf7 plugin, and as a result it will not be validated, you'll need to do that yourself. It won't either be available to add to the notification mail, this too you will need to programmatically enable.

1
  • Although the CF7 plugin author never designed the tag elements to be filtered to add custom attributes to HTML elements, there is a hack that has been suggested in this answer to circumvent this, however I don't recommend it.
    – Aurovrata
    Commented May 20, 2020 at 15:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.