开发者

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

开发者 https://www.devze.com 2023-01-20 15:50 出处:网络
So right now it all looks pretty with ... <button type=\"submit\" runat=\"server\" name=\"subscribe\" id=\"Button1\" class=\"link-button\" onserverclick=\"saveListing\">

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

精彩评论

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