-2
Hello guys I’m having a problem, I have to make a button have "2 functions" actually this all working properly, so my client wants the following...
when the user clicks to register and all fields are correct, he registers and shows the success message in a modal, with a button that redirects to home. And if it fails to fill some field and click on the button it shows a message on the same label.
it is all right working just do not know how to do, because in what I tried, it shows the modal whenever you click the button filling or not the fields.
Here is my modal; /* Java modal services window */ var $j = jQuery.noConflict();
$j(document).ready(function () {
var nome = $("#txtNome").val();
var mail = $("#txtEmailC").val();
var fone = $("#txtFoneC").val();
if (nome != "" && mail != "" && fone != "") {
//$(document).ready(function () {
$("a[rel=modal]").click(function (ev) {
ev.preventDefault();
var id = $(this).attr("href");
var maskHeight = $(document).height();
var maskWidth = $(window).width();
//colocando cor de fundo
$('#mask').css({ 'width': maskWidth, 'height': maskHeight });
$('#mask').fadeIn(1000);
$('#mask').fadeTo("slow", 0.8);
var winH = $(window).height();
var winW = $(window).width();
$(id).css('top', winH / 2 - $(id).height() / 2);
$(id).css('left', winW / 2 - $(id).width() / 2);
$(id).fadeIn(2000);
});
$('.window2 .close').click(function (ev) {
ev.preventDefault();
$('#mask').hide();
$('.window2').hide();
});
$('#mask').click(function () {
$(this).hide();
$('.window2').hide();
});
//});
}
});
</script>
here the button that calls the modal if everything is filled out:
Well it’s like this if someone knows another solution or if you can solve it anyway. Someone knows how to do it?
As far as I can tell, everything points to you missing a parole if Else to check whether the fields are empty or not, and to perform the corresponding actions.
– carlosrafaelgn
Without looking at the code it is difficult to say what the problem is
– Paulo
@Delivery-TI Post code to analyze.
– Lucas Henrique
use if Else but it ai show the message in label. has how to pass the modal within if ...?
– Delivery-TI
Is it possible to direct the modal within an if... because the modal is already ready but I do not know how to make it appear only if the registration is carried out I left the message on the label anyway, but I do not like much I find unprofessional. kkkk
– Delivery-TI
I answered your question. As you read, your question is incomplete. Please be more thorough when asking questions and take a look at the help center: http://answall.com/help/mcve
– Sergio