enabling the next row if the previous row information is filled












1














I am working with HTML and jQuery.



Demo link : http://plnkr.co/edit/rQyqNcxHvCI9WZOArOHz?p=preview



I have dropdown list in the columns Product1 and Product2 of the table. I want to check if user has selected same values in the dropdown list of Product1 and Product2 for each row and show the error message "Product1 and Product2 cannot have same values". This validation i need to do only when user Description field has some value.
Example, if user selects same value in Product1 and Product2 and Description field is empty, don't show the popup dialog box, but when user enters the data in Description column then show the pop up dialog box with message.



I have written the below js code which does the validation when user changes the dropdown list and it is working, i want to modify the below method call when user enters the text in the Description text field instead of the select onchange function.



//want to modify the below function so that it validates when user enters the text in the Description column instead of onchange event..
$("select").change(function()
{
var row = $(this).closest("tr");
var product1_drop = $('.product1',row).val();
var product2_drop = $('.product2',row).val();
if(product1_drop == product2_drop ){
alert('Product1 and Product2 cannot have same value');
}
});


Inputs would be helpful. Thanks.










share|improve this question




















  • 1




    Alright, so given that if you want to enable the next row when the previous row is filled out, suggests that all but the first one is disabled on page load. Do you have that part figured out? Then when they change, you have to check if both have a value, and are not duplicate. If they are filled out and not dupes, you can get the row.next() and enable the nested fields. Do you have questions about that? What part of this issue, specifically, are you having difficulty with?
    – Taplar
    Nov 16 '18 at 20:02










  • @Taplar - As said above i'm having difficulty in enabling the next row when previous row Product1,Description and Product2 fileds are filled.
    – user3684675
    Nov 16 '18 at 20:19










  • That doesn't tell us what specific problem you are having. There are multiple steps to do this. You need to ask specifically about which part you are having a problem with. Otherwise this is too broad, and could be viewed as a coding request. Break down the problem into steps. Try to do those steps yourself. If you have an issue with a step, then ask a question about it.
    – Taplar
    Nov 16 '18 at 20:20












  • Sorry, please see the post above, i have modified and made it simple to understand. I have written a javascript function $("select").change(function() which validates if values in two dropdown list are same and show the dialog message, i just want to call that change(.. )function when user enters some text in the Description column and perform the same validation which i have written in the change function..I was confused as which function needs to be called when user enters some text in the text field Description..
    – user3684675
    Nov 16 '18 at 20:49










  • So just change your event handler to bind on the description fields. To make that very easy, put a class of "description" on the description input fields, and find them by that class.
    – Taplar
    Nov 16 '18 at 20:50


















1














I am working with HTML and jQuery.



Demo link : http://plnkr.co/edit/rQyqNcxHvCI9WZOArOHz?p=preview



I have dropdown list in the columns Product1 and Product2 of the table. I want to check if user has selected same values in the dropdown list of Product1 and Product2 for each row and show the error message "Product1 and Product2 cannot have same values". This validation i need to do only when user Description field has some value.
Example, if user selects same value in Product1 and Product2 and Description field is empty, don't show the popup dialog box, but when user enters the data in Description column then show the pop up dialog box with message.



I have written the below js code which does the validation when user changes the dropdown list and it is working, i want to modify the below method call when user enters the text in the Description text field instead of the select onchange function.



//want to modify the below function so that it validates when user enters the text in the Description column instead of onchange event..
$("select").change(function()
{
var row = $(this).closest("tr");
var product1_drop = $('.product1',row).val();
var product2_drop = $('.product2',row).val();
if(product1_drop == product2_drop ){
alert('Product1 and Product2 cannot have same value');
}
});


Inputs would be helpful. Thanks.










share|improve this question




















  • 1




    Alright, so given that if you want to enable the next row when the previous row is filled out, suggests that all but the first one is disabled on page load. Do you have that part figured out? Then when they change, you have to check if both have a value, and are not duplicate. If they are filled out and not dupes, you can get the row.next() and enable the nested fields. Do you have questions about that? What part of this issue, specifically, are you having difficulty with?
    – Taplar
    Nov 16 '18 at 20:02










  • @Taplar - As said above i'm having difficulty in enabling the next row when previous row Product1,Description and Product2 fileds are filled.
    – user3684675
    Nov 16 '18 at 20:19










  • That doesn't tell us what specific problem you are having. There are multiple steps to do this. You need to ask specifically about which part you are having a problem with. Otherwise this is too broad, and could be viewed as a coding request. Break down the problem into steps. Try to do those steps yourself. If you have an issue with a step, then ask a question about it.
    – Taplar
    Nov 16 '18 at 20:20












  • Sorry, please see the post above, i have modified and made it simple to understand. I have written a javascript function $("select").change(function() which validates if values in two dropdown list are same and show the dialog message, i just want to call that change(.. )function when user enters some text in the Description column and perform the same validation which i have written in the change function..I was confused as which function needs to be called when user enters some text in the text field Description..
    – user3684675
    Nov 16 '18 at 20:49










  • So just change your event handler to bind on the description fields. To make that very easy, put a class of "description" on the description input fields, and find them by that class.
    – Taplar
    Nov 16 '18 at 20:50
















1












1








1







I am working with HTML and jQuery.



Demo link : http://plnkr.co/edit/rQyqNcxHvCI9WZOArOHz?p=preview



I have dropdown list in the columns Product1 and Product2 of the table. I want to check if user has selected same values in the dropdown list of Product1 and Product2 for each row and show the error message "Product1 and Product2 cannot have same values". This validation i need to do only when user Description field has some value.
Example, if user selects same value in Product1 and Product2 and Description field is empty, don't show the popup dialog box, but when user enters the data in Description column then show the pop up dialog box with message.



I have written the below js code which does the validation when user changes the dropdown list and it is working, i want to modify the below method call when user enters the text in the Description text field instead of the select onchange function.



//want to modify the below function so that it validates when user enters the text in the Description column instead of onchange event..
$("select").change(function()
{
var row = $(this).closest("tr");
var product1_drop = $('.product1',row).val();
var product2_drop = $('.product2',row).val();
if(product1_drop == product2_drop ){
alert('Product1 and Product2 cannot have same value');
}
});


Inputs would be helpful. Thanks.










share|improve this question















I am working with HTML and jQuery.



Demo link : http://plnkr.co/edit/rQyqNcxHvCI9WZOArOHz?p=preview



I have dropdown list in the columns Product1 and Product2 of the table. I want to check if user has selected same values in the dropdown list of Product1 and Product2 for each row and show the error message "Product1 and Product2 cannot have same values". This validation i need to do only when user Description field has some value.
Example, if user selects same value in Product1 and Product2 and Description field is empty, don't show the popup dialog box, but when user enters the data in Description column then show the pop up dialog box with message.



I have written the below js code which does the validation when user changes the dropdown list and it is working, i want to modify the below method call when user enters the text in the Description text field instead of the select onchange function.



//want to modify the below function so that it validates when user enters the text in the Description column instead of onchange event..
$("select").change(function()
{
var row = $(this).closest("tr");
var product1_drop = $('.product1',row).val();
var product2_drop = $('.product2',row).val();
if(product1_drop == product2_drop ){
alert('Product1 and Product2 cannot have same value');
}
});


Inputs would be helpful. Thanks.







javascript jquery html css






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 16 '18 at 20:46

























asked Nov 16 '18 at 19:58









user3684675

1251517




1251517








  • 1




    Alright, so given that if you want to enable the next row when the previous row is filled out, suggests that all but the first one is disabled on page load. Do you have that part figured out? Then when they change, you have to check if both have a value, and are not duplicate. If they are filled out and not dupes, you can get the row.next() and enable the nested fields. Do you have questions about that? What part of this issue, specifically, are you having difficulty with?
    – Taplar
    Nov 16 '18 at 20:02










  • @Taplar - As said above i'm having difficulty in enabling the next row when previous row Product1,Description and Product2 fileds are filled.
    – user3684675
    Nov 16 '18 at 20:19










  • That doesn't tell us what specific problem you are having. There are multiple steps to do this. You need to ask specifically about which part you are having a problem with. Otherwise this is too broad, and could be viewed as a coding request. Break down the problem into steps. Try to do those steps yourself. If you have an issue with a step, then ask a question about it.
    – Taplar
    Nov 16 '18 at 20:20












  • Sorry, please see the post above, i have modified and made it simple to understand. I have written a javascript function $("select").change(function() which validates if values in two dropdown list are same and show the dialog message, i just want to call that change(.. )function when user enters some text in the Description column and perform the same validation which i have written in the change function..I was confused as which function needs to be called when user enters some text in the text field Description..
    – user3684675
    Nov 16 '18 at 20:49










  • So just change your event handler to bind on the description fields. To make that very easy, put a class of "description" on the description input fields, and find them by that class.
    – Taplar
    Nov 16 '18 at 20:50
















  • 1




    Alright, so given that if you want to enable the next row when the previous row is filled out, suggests that all but the first one is disabled on page load. Do you have that part figured out? Then when they change, you have to check if both have a value, and are not duplicate. If they are filled out and not dupes, you can get the row.next() and enable the nested fields. Do you have questions about that? What part of this issue, specifically, are you having difficulty with?
    – Taplar
    Nov 16 '18 at 20:02










  • @Taplar - As said above i'm having difficulty in enabling the next row when previous row Product1,Description and Product2 fileds are filled.
    – user3684675
    Nov 16 '18 at 20:19










  • That doesn't tell us what specific problem you are having. There are multiple steps to do this. You need to ask specifically about which part you are having a problem with. Otherwise this is too broad, and could be viewed as a coding request. Break down the problem into steps. Try to do those steps yourself. If you have an issue with a step, then ask a question about it.
    – Taplar
    Nov 16 '18 at 20:20












  • Sorry, please see the post above, i have modified and made it simple to understand. I have written a javascript function $("select").change(function() which validates if values in two dropdown list are same and show the dialog message, i just want to call that change(.. )function when user enters some text in the Description column and perform the same validation which i have written in the change function..I was confused as which function needs to be called when user enters some text in the text field Description..
    – user3684675
    Nov 16 '18 at 20:49










  • So just change your event handler to bind on the description fields. To make that very easy, put a class of "description" on the description input fields, and find them by that class.
    – Taplar
    Nov 16 '18 at 20:50










1




1




Alright, so given that if you want to enable the next row when the previous row is filled out, suggests that all but the first one is disabled on page load. Do you have that part figured out? Then when they change, you have to check if both have a value, and are not duplicate. If they are filled out and not dupes, you can get the row.next() and enable the nested fields. Do you have questions about that? What part of this issue, specifically, are you having difficulty with?
– Taplar
Nov 16 '18 at 20:02




Alright, so given that if you want to enable the next row when the previous row is filled out, suggests that all but the first one is disabled on page load. Do you have that part figured out? Then when they change, you have to check if both have a value, and are not duplicate. If they are filled out and not dupes, you can get the row.next() and enable the nested fields. Do you have questions about that? What part of this issue, specifically, are you having difficulty with?
– Taplar
Nov 16 '18 at 20:02












@Taplar - As said above i'm having difficulty in enabling the next row when previous row Product1,Description and Product2 fileds are filled.
– user3684675
Nov 16 '18 at 20:19




@Taplar - As said above i'm having difficulty in enabling the next row when previous row Product1,Description and Product2 fileds are filled.
– user3684675
Nov 16 '18 at 20:19












That doesn't tell us what specific problem you are having. There are multiple steps to do this. You need to ask specifically about which part you are having a problem with. Otherwise this is too broad, and could be viewed as a coding request. Break down the problem into steps. Try to do those steps yourself. If you have an issue with a step, then ask a question about it.
– Taplar
Nov 16 '18 at 20:20






That doesn't tell us what specific problem you are having. There are multiple steps to do this. You need to ask specifically about which part you are having a problem with. Otherwise this is too broad, and could be viewed as a coding request. Break down the problem into steps. Try to do those steps yourself. If you have an issue with a step, then ask a question about it.
– Taplar
Nov 16 '18 at 20:20














Sorry, please see the post above, i have modified and made it simple to understand. I have written a javascript function $("select").change(function() which validates if values in two dropdown list are same and show the dialog message, i just want to call that change(.. )function when user enters some text in the Description column and perform the same validation which i have written in the change function..I was confused as which function needs to be called when user enters some text in the text field Description..
– user3684675
Nov 16 '18 at 20:49




Sorry, please see the post above, i have modified and made it simple to understand. I have written a javascript function $("select").change(function() which validates if values in two dropdown list are same and show the dialog message, i just want to call that change(.. )function when user enters some text in the Description column and perform the same validation which i have written in the change function..I was confused as which function needs to be called when user enters some text in the text field Description..
– user3684675
Nov 16 '18 at 20:49












So just change your event handler to bind on the description fields. To make that very easy, put a class of "description" on the description input fields, and find them by that class.
– Taplar
Nov 16 '18 at 20:50






So just change your event handler to bind on the description fields. To make that very easy, put a class of "description" on the description input fields, and find them by that class.
– Taplar
Nov 16 '18 at 20:50














0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53344581%2fenabling-the-next-row-if-the-previous-row-information-is-filled%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53344581%2fenabling-the-next-row-if-the-previous-row-information-is-filled%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

ComboBox Display Member on multiple fields

Is it possible to collect Nectar points via Trainline?