API action fails sending signature field draw it data with repeater field data

By: Jane Onorati | Asked: 12/14/2024
ForumsCategory: How-toAPI action fails sending signature field draw it data with repeater field data
Jane OnoratiJane Onorati asked 1 month ago

I am pretty sure this is a bug and have contacted Formidable Support about it.  I have a form that has a repeater in it and a signature field outside of the repeater.  I have an API post action to send this data to another form.  The receiving fields match with the sending fields, except the signature is sent to a text field as that's the only way to transfer the signature to a field in another form.  The data all shows up in the destination form unless you choose to draw the signature instead of type it.  The Formidable Log shows the action ends in a 400 error if you draw a signature.  Also if you don't transfer any repeater data, a drawn signature will be transferred to the destination field just fine.

I'm trying to come up with a work-around but the only thing that looks like it could work is PHP.  However the value transferred is serialized.  Any suggestions for a work around?   The attached text file shows an example of the serialized data for a drawn signature.  An example of the one for the typed signature is much shorter (signature is "Jane"):  a:3:{s:7:"content";s:4:"Jane";s:5:"typed";s:4:"Jane";s:6:"format";s:5:"typed";}.

Attachments
1 Answers
Victor Font answered 1 month ago
The attachment is unreachable. If I recall, signatures are saved as .png files. If you have to unserialize() to convert the serialized array into a workable array. If you want to post the other array, use pastebin or gist and post the link here.
Jane OnoratiJane Onorati replied 1 month ago

Hi Victor. I did get a response from Toyin at Formidable Support: "This is because the file path breaks the format when sending data RAW format. The signature field sends a file path, this path contains characters that affect the data structure in RAW format. I have escalated this to our developers for further review." I'll wait to see if they come up with a fix. I have handled serialized data in PHP before but don't remember how I did it so would need to review how to do that.

Jane OnoratiJane Onorati replied 1 month ago

Well, I got as far as I could with support, but it does not totally solve the problem. I was told I could use [x show=url] in the API action, where x is the ID of the signature field. However, then there is the problem of how to display the signature image when needed.

This does transfer the signature url to the receiving form without error. However it works differently than when I have done this with forms that do not have repeaters and not using the API raw format. When I look at the entry produced by an API json format action, I see the image. However, using this method, I don't see the image but instead just the url.

I need to be able to display the signature image in views. I also have a working form without repeaters that creates a pdf signed waiver using e2pdf. I want to be able to do the same with repeaters and e2pdf or Formidable's PDF add-on (which requires a view).

Then support suggested I could display the image in a view by using the image tag, i.e. '<img src="[x]"/>', where x is the ID of the signature field where the URL is saved. That works but only for the signatures that are drawn and does not work for the ones that are typed. Support had no suggestion for a conditional shortcode that would display the signature based on whether it was typed or drawn. So unless I can figure a way to solve that, I'd have to offer all form users only one option for creating their signature.

Jane OnoratiJane Onorati replied 1 month ago

I was able to display the signatures by type conditionally using both the e2pdf plug-in and in a view. In both cases, I used the criteria of whether the field contained "https" in it or not to display each signature in the correct format.

In the view, it looks like this: [if 6pl98 contains="https"][/if 6pl98][if 6pl98 does_not_contain="https"][6pl98][/if 6pl98]. In my e2pdf template, I have an image object field and an html object field on top of each other with actions that hide the elements based on the same criteria.

So the complete solution is to use [x show=url] in the API action, where x is the ID of the signature field, and then display the signature that has been delivered to a text field in another form conditionally based on whether "https" is contained in the value.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right