我在 textarea 和 jQuery 验证插件(http://bassistance.de/jquery-plugins/jquery-plugin-validation/)上使用 CKEditor
使用 jQuery 插件可以将字段标记为空或必需。当“产品名称”等字段为空时,提交表单时该字段将被标记为无效。
但是,在输入“产品名称”时,该字段将在输入时自动标记为有效。太好了,但我想对启用 CKEditor 的 textarea 也有同样的效果。使用纯文本区域一切正常(输入文本时,该字段变为有效),但是在将 CKEditor 添加到文本区域后,这不再起作用。
从那时起,您必须在 CKEditor textarea 重新验证之前单击提交按钮。
关于如何使这项工作有任何想法?
更新:
我尝试了您给我的线程中的解决方案,但它不起作用: 使用 jQuery 从 CKEditor 的 iframe 中获取内容
我有:
CKEDITOR.instances["page_content"].document.on('keydown', function(event)
{
CKEDITOR.tools.setTimeout( function()
{
$("#page_content").val(CKEDITOR.instances.page_content.getData());
}, 0);
});
Run Code Online (Sandbox Code Playgroud)
但这一直给我:“CKEDITOR.instances.page_content.document 未定义”
我的 textare 的 id 是“page_content”
单击按钮后这可以正常工作,但是正如您所见,我需要以某种方式触发 keydown 事件
$("#btnOk").click(function(event) {
CKEDITOR.instances.page_content.updateElement(); //works fine
});
Run Code Online (Sandbox Code Playgroud)
更新 2:
这段代码是正确的,它将数据从 CKEDITOR 获取到我的 textarea 中,但是,我的验证插件仍然没有发生任何事情,它在 CKEDitor 中没有“在我输入时做出响应”,而它应该做出反应并说该字段在我输入时正常输入一些文字
CKEDITOR.instances["page_content"].on("instanceReady", function()
{
//set keyup event
this.document.on("keyup", updateTextArea);
//and paste event
this.document.on("paste", …
Run Code Online (Sandbox Code Playgroud) 我正在开发一个WPF应用程序并且我非常了解命令模式,但我发现MVVM的命令模式有几种不同的实现.Josh Smith在他的WPF示例应用程序中实现,DelegateCommand
来自Prism,以及CommandBindings
实现.
我的问题是,使用MVVM命令的普遍接受的最佳做法是什么?我的应用程序使用Prism,因此DelegateCommand
我们可以使用.
我团队的开发人员正在争论哪种方法"最好".有些人不喜欢为每个命令生成的众多.cs文件,有些人更喜欢通过连接所有内容CommandBindings
.我不知所措.任何人都能解释一下吗?
我从我的shell脚本开始后台进程,我想在脚本完成时终止这个进程.
如何从我的shell脚本中获取此进程的PID?据我所知,变量$!
包含当前脚本的PID,而不是后台进程.
这是很容易设置的默认字体通过GtkTextView gtk_widget_modify_font()
,但如何让哪一个是当前的?(我没有在小部件中使用任何标签.)
我正在使用JDBC与MySQL同步,以向MySQL数据库的表添加和定义行.问题是,Exception
当我使用ResultSet
类中的方法向表中添加行时,我不知道它为什么会抛出.请记住,我之前曾尝试通过ResultSet
方法读取表格,并成功打印出单元格值.以下是有关代码的内容:
public void run(){
try {
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection(
"jdbc:mysql://localhost:3306/temp_book_database","root","1234");
ResultSet set = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE).executeQuery("SELECT * FROM book_info");
set.moveToInsertRow();
set.updateString(1, "Osama's POV"); set.updateString(2, "Osama B Laden");
set.updateInt(3, 2800); set.updateString(4, "Osama bin Laden's debute book on terrorism");
set.insertRow(); set.moveToCurrentRow();set.beforeFirst();
//I'm guessing the bottom while loop is not executed because the above is generating the Exception
while (set.next()){
System.out.println(set.getString("Book_Title")+ set.getString("Book_Author")+ set.getString("MRP")+set.getString("Comments"));
}
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} …
Run Code Online (Sandbox Code Playgroud) 我在使用jquery和选择框的IE7中遇到问题.当我设置选择框的宽度,然后使用jquery重新填充第一个选择框更改时的项目时,第二个选择框将根据设置的宽度减少.
例如:以下代码使用两个选择框.当第一个选择框触发更改事件时,它将删除所有第二个选择框并添加一些新值.如果我删除第二个选择框的样式属性,则满足所需的行为.保留style属性后,第二个选择框将变得越来越小,最终消失.
这只发生在IE7中.
代码如下:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>test</title>
<script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#selOne").change(function(){
//Clear out the current service list
$("#selTwo option").each(function(){
$(this).remove();
});
for(var i=0; i < 10; i++){
var newOption = '<option value="'+ i +'">'+ i +'</option>';
$("#selTwo").append(newOption);
}
});
});
</script>
</head>
<body>
<select id="selOne" class="number req" style="width: 90%;">
<option value="" selected="selected">Initial Select</option>
<option value="">a</option>
<option value="">b</option>
<option value="">c</option>
</select>
<select id="selTwo" class="number req" style="width: 90%;">
<option value="" selected="selected">These should update</option>
<option value="">100</option>
<option …
Run Code Online (Sandbox Code Playgroud) 当id是我的SQL表的一个键时,我使用prepareStatement(),它将由SQL创建,我想使用这个语句:(我应该在SQL表的第一列中写什么而不是X(提醒:SQL创建)它自动)
File file = new File(pathFile);
FileInputStream input = new FileInputStream(file);
query = ("insert into birthtable VALUES(?,?,?,?,?,?,?,?)");
pstmt = (PreparedStatement) conn.prepareStatement(query);
pstmt.setInt(1,**X** )
pstmt.setString(2, name);
pstmt.setString(3, family);
pstmt.setString(4, fatherName);
pstmt.setString(5, mName);
pstmt.setString(6, dOfBirth);
pstmt.setString(7, pOfBirth);
// Method used to insert a stream of bytes
pstmt.setBinaryStream(8, input);
pstmt.executeUpdate();
Run Code Online (Sandbox Code Playgroud)
我已经做了你们所说的但是我有这个例外吗?
java.sql.SQLException: Column count doesn't match value count at row 1
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3491)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3423)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2542)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1734)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2019)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1937)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1922) …
Run Code Online (Sandbox Code Playgroud) 我刚刚进入MEF,我遇到了一个我无法解决的问题.我有一个Windows服务正在读取我的DLL(通过MEF),每个DLL是一个WCF服务主机.当我运行我的Windows服务并读入DLL时,一切运行正常,除了每当一个WCF DLL获得任何"活动",然后他们重新实例化然后处理进来的数据.我需要它们在开始时实例化一次.这可能吗?
在Python中存储时间(在我的情况下在ZODB中,但适用于任何数据库),您使用什么格式(纪元,日期时间等),为什么?