English 中文(简体)
使用以 struts 书写表格的 jQuery 验证插件
原标题:Using jQuery validation plugin with a form written in struts

我想执行 jQuery 验证插件, 用于以 Java 和 struts 书写的网络应用程序。 我只是想用它验证格式输入, 看看它们是否符合某些规则, 然后再提交给数据库。 我试图执行的项目是由别人写的, 我无法访问它们, 我无法重写它 。

以下是我要验证的表格输入内容之一:

<html:text property="groomFirstName" maxlength="30" tabindex="1" styleId="groomFirstName"  size="15" onchange="properCase(this.id); needToConfirm=true;"   />

我为插件编写了一些自定义方法。 我用简单的 HTML 格式测试了这些方法, 但我不使用像上面的代码线那样的 struts 代码 。

最佳回答

Struts 用于生成窗体的事实无关紧要。 JavaScript 在浏览器中执行, HTML 是 HTML 。

上面的代码行不是 HTML 。 它会对在服务器端上评估并生成发送到浏览器的 HTML 代码的 JSP 标记进行 Struts。 jQuery 只关心 HTML 。 上述代码将生成以下 HTML :

<input type="text" name="groomFirstName" maxlength="30" tabindex="1" 
       id="groomFirstName" size="15" 
       onchange="properCase(this.id); needToConfirm=true;" />
问题回答

暂无回答




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签