Android Question jSignature webview

josejad

Expert
Licensed User
Longtime User
Hi:

I have a small webpage where I capture a signature and save it in my db into a small text format (base30).

https://willowsystems.github.io/jSignature/#/about/

I've made a small html page with a jSignature pad and I load it into a WebView. I would like to get the base30 string from the WebView.

Do I need to use WebViewExtras? Or could I get it just with the Webview?

See attached a small example.

Thanks¡¡
 

Attachments

  • jsignaturesample.zip
    62 KB · Views: 275

josejad

Expert
Licensed User
Longtime User
Thanks ronell, I watched the threads related with signature capture before start trying this solution. If I can't get it work, I probably will use the DonMamfred wrap "Signature Capture Dialog", I think it produces smoother images.

Well, I'm trying to get the base30 (or base64) value of the signature with WebViewExtras v2.

I have this javascript in my html, it returns the encoded string of my signature, and (just testing) it change document.title to the encoded string too.

B4X:
function Base30() {
    document.title = $('#signature').jSignature('getData', 'base30');
    return $('#signature').jSignature('getData', 'base30');
}

Now, in my app:
B4X:
Sub Button1_Click
    Dim Javascript As String
    Javascript="B4A.CallSub('GetBase30', true, Base30())"
    WebViewExtras1.ExecuteJavascript(Javascript)
End Sub

Sub GetBase30(data As String)
    Msgbox(data, "Enconded Data")
    Label1.Text = data
End Sub

The value I get is "undefined", while if I execute my html in a browser, I get the right values.

Thanks in advance,
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…