Triggering a modal within another modal is preventing the form from being submitted

I'm currently facing an issue with my modals. I have a modal that contains login inputs and a link that triggers another modal for registration.

Both modals rely on the same form in my asp.net master page, and all inputs have required field validators set up.

The problem arises when I open the second modal - I am unable to submit the form because it detects the user/password inputs from the first modal as empty and does not validate them.

Is there a way to programmatically remove those inputs from either the codebehind or using JavaScript when clicking on

<a href="#Div1" data-toggle="modal" data-dismiss="myModal">Register now</a>
or
<button ID="bnt" type="button" data-toggle="modal" data-target="#Div1">Register now</button>

Any help is greatly appreciated. Thank you.

Answer №1

It seems like you're working with asp.net WebForms instead of asp.net MVC, as you mentioned MasterPage and not a layout page.

To prevent the validation of login fields when registering, use a different ValidationGroup for the registration form. This way, clicking the register button won't trigger validations for the login fields.

<asp:Button ValidationGroup="Register"...>Register</asp:Button>

Make sure to adjust the validators for the registration fields to have the same "Register" validation group.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Creating a unique CSS animation featuring a vertical line intersecting a horizontal line

Check out this cool expanding line animation I created using CSS, see it in action here I'm looking for assistance on how to add vertical lines at both ends once the animation stops. Something similar to the image shown below: https://i.sstatic.net/ ...

Mastering the art of nested await functions in JavaScript

In my current Nodejs application using mongoose, I am implementing cache with MongoDB in-memory and MongoDB database. This setup is running on Nodejs 8.9 with async/await support enabled. let get_func = async(userId) => { let is_cached = await c ...

The angular controller function is failing to set $scope.value

I've been facing an issue with setting an Angular variable value in a controller function that is created by a directive. For some reason, it doesn't seem to work when I try to assign the value within the controller function, even though it displ ...

jQuery Chosen not triggering the onchange event after updating the value using JavaScript

JSFiddle In the JSFiddle link provided, I have created a select element with 3 options (including one blank option). When manually switching from foo to bar, the change event listener works as expected. However, when resetting the select element via Java ...

Creating seamless online payments using Stripe and Bootstrap

I'm new to integrating Stripe for payment processing on my Bootstrap website and currently utilizing Stripe.js v2. As far as I understand, the process involves my HTML form communicating with Stripe via JavaScript to obtain a token (or handle any err ...

Obtaining the absolute URL of a SharePoint site

Is there a way to retrieve the absolute URL of a site from within an aspx page without using codebehind? I attempted to use $SPUrl, but it only provides a relative URL. <asp:Literal runat="server" text="<% $SPUrl:~Site/mypage.aspx %>" /> whic ...

Whenever I trim down the images, the captions somehow get lost in the thumbnail

My issue arises when cropping photos, as the captions end up being hidden within the thumbnail images. How can I ensure that the captions are visible and also make all images the same height? I am striving to achieve a layout similar to this: ![][2] ...

Filtering text for highlighting in Vue.js is a breeze

Struggling to create a text highlight filter using vuejs. The task involves iterating through an array of words, highlighting any matches with a span and class. However, I'm facing difficulty in getting the data to return with proper HTML formatting i ...

Are all Flash swf files equipped with predefined methods for connecting to Javascript?

Although I am unfamiliar with Flash, I have been tasked with embedding a swf film into a web page. The swf plays a short film, and I would like to be able to control when it starts playing, rewind it, and potentially cache it in the browser. This swf will ...

Guide on locating the Literal and Link Buttons within a Repeater control

<asp:Repeater runat="server" ID="rpt"> <ItemTemplate> <asp:LinkButton ID="MyLink" runat="server" Text="Fair" ></asp:LinkButton> <span class="literal"> (<asp:Literal runat ...

JavaScript event listener on the "change" event only triggers when changed manually [CodePen]

Check out this jsFiddle I created with all the data and information related to the issue. It should make it easier to understand what's happening: Take a look here: http://jsfiddle.net/lukinhasb/GuZq2/ $("#estado").val(unescape(resultadoCEP["uf"])); ...

What steps should I take to implement asynchronous functionality in my code for a Google Chrome Extension?

I am currently working on a Google Chrome extension that needs to gather data from two different servers and send it to another service. I am facing an issue with making the process asynchronous, even though the requests are functioning properly. After se ...

Retrieve the input data following validation of an AngularJS form

Hello there! I am relatively new to utilizing AngularJS and Bootstrap. Recently, I have created a login form using AngularJS and Bootstrap CSS. Below you will find the code for my form: <form name="userForm" ng-submit="submitForm(userForm.$valid)" nova ...

Assistance Needed with RDLC Text Box Expressions!

I am working on customizing a table in my RDLC file. I need to dynamically change the text of a specific column based on a value retrieved from the database. I attempted the following code snippet: =iif(First(Fields!IsMemberOfHousehold.Value, "DSClientCon ...

Vue encountering RangeError due to string length inconsistency in specific environments only

My Vue component is currently live in production within a WordPress theme, but I am encountering an error: jquery.min.js:2 Uncaught RangeError: Invalid string length at repeat$1 (vue.js:11398) at generateCodeFrame (vue.js:11380) at vue.js:1146 ...

Tips for concealing a div using an article until it is activated by hovering over it

I am looking to incorporate a sleek sliding animation on an article that reveals more information in a div upon mouseover. A great example of this can be seen on where clicking at the top right corner triggers the "Show Modern Dev Ad" feature. Below is m ...

The loading spinner feature in the UI Route does not function properly unless the $timeout component is included

In my Angular application that uses UI Router, I have set up subscriptions to the $stateChangeStart and $stateChangeSuccess events. Within these event handlers, I am toggling a controller property called "isLoading" to show or hide a loading indicator outs ...

Calculating the quantity of elements within a jQuery array

A JQuery array is proving to be quite problematic. Here's what it looks like, [125, "321", "kar", 125, "sho", "sho", 12, 125, "32", 32] Unfortunately, there are duplicates present in this array. My goal is to obtain the count of each unique element ...

Is there a method to successfully utilize "const {user, userId} = this.state" when user pertains to username and userId pertains to id?

for instance state = { "username": "abc", "id": "1", } const {username, id} = this.state the code above will retrieve the values successfully is there a method to enable the following code to also ...

Is there a way to swap out values in a JavaScript Object for new ones?

I need to update the initial values of myObject with new names: let myObject = [ { name: 'X0', values: 'FALSE,TRUE' } , { name: 'X1', values: 'NORMAL,LOW,HIGH' } , { name: 'X2', values: ' ...