Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.
Forum rules: Please search to see if a question has already asked before creating a new topic. Please don't post the same question in multiple forums.
#829535
Hello,
you can use the form setOnchange() to monitor the checkbox in grid. When it is being checked, if the text box in grid is not empty, then copy its value to the other text box.

2. setOnchange() to monitor the text box in grid. then check if the checkbox in grid is checked, then you can make a copy of textbox value in grid to another textbox.

Let me know if you need the coding example, then I can write next time. Cheers
#829536
kirkwg wrote: Fri Oct 01, 2021 12:45 pm Hello,
you can use the form setOnchange() to monitor the checkbox in grid. When it is being checked, if the text box in grid is not empty, then copy its value to the other text box.

2. setOnchange() to monitor the text box in grid. then check if the checkbox in grid is checked, then you can make a copy of textbox value in grid to another textbox.

Let me know if you need the coding example, then I can write next time. Cheers
Absolutely! coding example with help get me off my feet. Thank you
#829537
Code: Select all
//==1. monitor if checkbox in a grid has checked
$("form").setOnchange( function( fieldId, newValue, oldValue ) {
   var aMatches = fieldId.match(/^\[grid_id\]\[(\d+)\]\[checkbox_id\]$/);
  
   if (aMatches) {    
     var rowNo       = aMatches[1];
 
     if (newValue == 1) {     	//1=checkbox checked
        var textboxInGridValue = $("#grid_id").getValue(rowNo, 1);	//e.g.1=column 1 of the textbox column
		if (textboxInGridValue != ""){
			$("#anotherTextboxId").setValue(textboxInGridValue);
		}
   }
});
//==replace your id's for grid_id, checkbox_id, anotherTextboxId

Note, item 2 to monitor the textbox in grid is similar that you could write following the above sample, thanks.
Let me know if you still encounter any sytax or coding problem, cheers.
#829540
kirkwg wrote: Fri Oct 01, 2021 1:39 pm
Code: Select all
//==1. monitor if checkbox in a grid has checked
$("form").setOnchange( function( fieldId, newValue, oldValue ) {
   var aMatches = fieldId.match(/^\[grid_id\]\[(\d+)\]\[checkbox_id\]$/);
  
   if (aMatches) {    
     var rowNo       = aMatches[1];
 
     if (newValue == 1) {     	//1=checkbox checked
        var textboxInGridValue = $("#grid_id").getValue(rowNo, 1);	//e.g.1=column 1 of the textbox column
		if (textboxInGridValue != ""){
			$("#anotherTextboxId").setValue(textboxInGridValue);
		}
   }
});
//==replace your id's for grid_id, checkbox_id, anotherTextboxId

Note, item 2 to monitor the textbox in grid is similar that you could write following the above sample, thanks.
Let me know if you still encounter any sytax or coding problem, cheers.
Thank you! I will try this out right away!
#829541
holysanta wrote: Fri Oct 01, 2021 2:46 pm
kirkwg wrote: Fri Oct 01, 2021 1:39 pm
Code: Select all
//==1. monitor if checkbox in a grid has checked
$("form").setOnchange( function( fieldId, newValue, oldValue ) {
   var aMatches = fieldId.match(/^\[grid_id\]\[(\d+)\]\[checkbox_id\]$/);
  
   if (aMatches) {    
     var rowNo       = aMatches[1];
 
     if (newValue == 1) {     	//1=checkbox checked
        var textboxInGridValue = $("#grid_id").getValue(rowNo, 1);	//e.g.1=column 1 of the textbox column
		if (textboxInGridValue != ""){
			$("#anotherTextboxId").setValue(textboxInGridValue);
		}
   }
});
//==replace your id's for grid_id, checkbox_id, anotherTextboxId

Note, item 2 to monitor the textbox in grid is similar that you could write following the above sample, thanks.
Let me know if you still encounter any sytax or coding problem, cheers.
Thank you! I will try this out right away!
Cant trace the error. Page refuses to load
#829544
Hello, the code previously has a minor syntax error, thats why it could not be loading. But as a coder like you, you should have the abilty to fix Javascript syntax error, otherwise you will encounter numerious difficulties!

I correct the syntax, verified by preview and it is now working. Take this code in below:
also see the result screenshot attached.
Code: Select all
//==monitor if checkbox in a grid has checked
$("form").setOnchange( function( fieldId, newValue, oldValue ) {
	//---------------------------------------------------------------------
   var aMatches2 = fieldId.match(/^\[grid2\]\[(\d+)\]\[cb_var01\]$/);
  
   if (aMatches2) {    
     rowNo       = aMatches2[1];	 alert("newValue = " + newValue + ", rowNo = " + rowNo);
 
     if (newValue == "1" || newValue == '"1"') {     	//1=checkbox checked
       
        var textboxInGridVal = $("#grid2").getValue(rowNo, 2);	//e.g.1=column 1 of the textbox column
        alert("newValue = " + newValue + ", textingrid = " + textboxInGridVal);
       
		if (textboxInGridVal != ""){
			$("#text_copy").setValue(textboxInGridVal);
		}
   	  }
   }  
});
//==replace your id's for grid2, cb_var01, text_copy
Good luck..
Attachments
PM364_text_copy.png
PM364_text_copy.png (23.79 KiB) Viewed 7631 times
Last edited by kirkwg on Sun Oct 03, 2021 8:22 pm, edited 1 time in total.
#829545
kirkwg wrote: Sat Oct 02, 2021 12:28 am Hello, the code previously has a minor syntax error, thats why it could not be loading. But as a coder like you, you should have the abilty to fix Javascript syntax error, otherwise you will encounter numerious difficulties!

I correct the syntax, verified by preview and it is now working. Take this code in below:
also see the result screenshot attached.
Code: Select all
//==monitor if checkbox in a grid has checked
$("form").setOnchange( function( fieldId, newValue, oldValue ) {
	//---------------------------------------------------------------------
   var aMatches2 = fieldId.match(/^\[grid2\]\[(\d+)\]\[cb_var01\]$/);
  
   if (aMatches2) {    
     rowNo       = aMatches2[1];	 alert("newValue = " + newValue + ", rowNo = " + rowNo);
 
     if (newValue == "1" || newValue == '"1"') {     	//1=checkbox checked
       
        var textboxInGridVal = $("#grid2").getValue(rowNo, 2);	//e.g.1=column 1 of the textbox column
        alert("newValue = " + newValue + ", textingrid = " + textboxInGridVal);
       
		if (textboxInGridVal != ""){
			$("#text_copy").setValue(textboxInGridVal);
		}
   	  }
   }  
//==replace your id's for grid2, cb_var01, text_copy
Good luck..
Thank you. I will take a look at it now. The grid pulls over 100 records. I have to see that the checkbox and textbox in each row is uniquely identified.

The market for cryptocurrencies is demonstrating a[…]

What's SAP FICO?

Embarking on a dissertation can be one of the most[…]

Hello. For rental housing, there are software solu[…]

Experience heightened pleasure with Cenforce 100 M[…]