jQWidgets Forums

jQuery UI Widgets Forums Plugins Validator, Drag & Drop, Sortable No validation by click on an "Edit" Button

This topic contains 1 reply, has 2 voices, and was last updated by  Peter Stoev 10 years, 10 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author

  • AJRames
    Participant

    Hey there,

    I’m programming in asp.net an C# in code behind.

    I have two buttons in my code.
    First the Save Button. Here I want to validate my form.
    The second one is an “Edit” Button. Here I don’t want an valdidation (because the edit Button should only make an redirection to another URL).

    The problem is that the validation occurs on both buttons….

    How can I solve this? As far as I see now both buttons want to make an “submit”, therefore the validation is active on both…

    Here my Code:

    $(document).ready(function () {
                
                $('#mainForm').jqxValidator({
                    rules: [
                     { input: '#<%= Tb_Subject.ClientID %>', message: '<%=  new MyLabel { ID = "Required" }.ToString() %>', action: 'keyup', rule: 'minLength=3' },
                     { input: '#<%= Tbx_Project.ClientID %>', message: 'Tbx_Project!', action: 'keyup', rule: 'required' },
                     {
                         input: '#<%= UserPicker_WorkersIntern.ClientID %>', message: '<%= new GebLabel { ID = "Required" }.ToString() %>', action: 'keyup', rule: function (input, commit) {
                             <%--var picker = $("#<%= UserPicker.ClientID %>").find('.my-user-picker-hidden-selected-names').val();
                             if (picker == '' || picker == null) {
                                 return false;
                             }--%>
                             return true;
                         }
                     },
                     { input: '#<%= Tb_StartDate.ClientID %>', message: 'Fill in the startdate!', action: 'keyup', rule: 'required' },
                     { input: '#<%= Tb_PlannedDate.ClientID %>', message: 'Fill in the planneddate!', action: 'keyup', rule: 'required' },
                     {
                         input: '#uniqueTinyMCEdiv', message: 'fill in', action: 'keyup', position: 'right:20,0', rule: function (input, commit) {
                             //var value = tinyMCE.get('TaskBodyNE').getBody().innerText;
                             //if (value == '' || value == null) {
                             //    return false;
                             //}
                             return true;
                         }
                     }
                    ], theme: 'summer'
                });
    
    //save button
    $("#<%=navSubmit.ClientID%>").click(function (evt) {
      var validation = $('#mainForm').jqxValidator('validate');
      return validation;
    })
    
    //edit Button
    $("#<%=navEdit.ClientID%>").click(function (evt) {
      return true;
      //nothing works, even I dont have this event
    })
    
    });
    

    ASP.NET Code:

    ...
    <li id="topEdit">
      <asp:LinkButton ID="navEdit" runat="server" OnClick="Btn_Edit_Click"></asp:LinkButton>
    </li>
    <li id="topSubmit">
      <asp:LinkButton ID="navSubmit" runat="server" OnClick="Btn_Submit_Click"></asp:LinkButton>
    </li>
    ...
    

    Thanks in advance


    Peter Stoev
    Keymaster

    Hi AJRames,

    Sorry, but we are not aware of your application’s specifics and we do not know why there are 2 buttons which try to submit your Form. My suggestion for you is to debug whether your both buttons are not Submit buttons or simply put Button HTML tags.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.