开发者

How to first use javascript to validate form data before triggering onServerClick for HTML Input button?

So right now it all looks pretty with ...

<button type="submit" runat="server" name="subscribe" id="Button1" class="link-button" onserverclick="saveListing">

Until it is time to validate the data before calling saveListing function codebehind开发者_开发问答 (in VB .Net).

How can true/false be return so that when true saveListing will be called, otherwise not?

Thank you.


add onclick='if(! validateFunction()) return false;.

I can't recall correctly whether HTML button control had onclicentclick property. Surely, if the web control <asp:Button ... it has a property OnClientClick where you can give the same value above for this effect as well.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜