gpt4 book ai didi

javascript - 签名板 - "Type It"不工作

转载 作者:行者123 更新时间:2023-12-03 21:38:40 25 4
gpt4 key购买 nike

我正在尝试使用 this(GitHub) , 我的“Draw It”按预期工作,但“Type It”功能在我的 inputHidden 中没有给我任何值(value) field 。

请参阅 VF 页面代码和屏幕截图以获取更多信息:

画画
Draw It showing "Value"

输入
Type It is not showing any "Value" in it

VF 页面代码

<apex:page standardController="Case" extensions="signaturepadCaseController">
<apex:includeScript value="{!URLFOR($Resource.jQuery,'js/jquery-1.6.2.min.js')}" />
<apex:includeScript value="{!URLFOR($Resource.signature,'/signature/jquery.signaturepad.min.js')}" />
<apex:includeScript value="{!URLFOR($Resource.signature,'/signature/json2.min.js')}" />
<apex:stylesheet value="{!URLFOR($Resource.signature,'/signature/jquery.signaturepad.css')}" />

<form method="post" action="#" class="sigPad">
<label for="name">Print your name</label>
<input type="text" name="name" id="name" class="name"/>
<p class="typeItDesc">Review your signature</p>
<p class="drawItDesc">Draw your signature</p>
<ul class="sigNav">
<li class="typeIt"><a href="#type-it" class="current">Type It</a></li>
<li class="drawIt"><a href="#draw-it">Draw It</a></li>
<li class="clearButton"><a href="#clear">Clear</a></li>
</ul>
<canvas class="pad" width="198" height="55" id="signatureCanvas1"></canvas>
<div class="sig sigWrapper">
<div class="typed" id="typeit">
</div>

<canvas class="pad" width="198" height="55" id="signatureCanvas"></canvas>
<input type="hidden" name="output" class="output" id="hidden"></input>

</div>
<input type="button" onclick="saveSignature();" value="Accept" class="btn" target="_parent" />
</form>
<script>
// $('.sigPad').signaturePad(options);
j$ = jQuery.noConflict();
var api;
j$(document).ready(function() {
api = j$('.sigPad').signaturePad();
});

var canvas;
var canvas1;
var RecordID = '';

function saveSignature() {
canvas = document.getElementById("signatureCanvas");
canvas1 = document.getElementById("signatureCanvas1");
// if(j$('#hidden').val() == ''){
// alert('Please draw your signature');
// }
// else{
RecordId = '{!caseId}';
var imgData;

typeSign = j$('#typeit').text();

if (typeSign != '') {
var ctx = canvas1.getContext("2d");
ctx.fillText(typeSign, 10, 10);
}
imgData = canvas1.toDataURL("image/jpeg");
imgData = imgData.split(',')[1];
console.log('---'+imgData);
strDataURI = imgData;
SignaturePad.signaturepadCaseController.saveSignature(strDataURI, RecordId, handleResult);
// }
}

function handleResult(result) {

if (result.indexOf('success:true')) {
//window.top.location = '/{!Case.id}';
} else {
alert(result);
}
}
</script>
</apex:page>

最佳答案

output变量仅在绘制签名时设置。输入签名时,不会绘制 Canvas ,而是覆盖带有文本的 div 以创建效果。您可以查看更多详情 issue在项目的问题跟踪器中,可能有 solution如果你可以 fork 代码。

关于javascript - 签名板 - "Type It"不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30589364/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com