Is there a way to reduce the number of rows that you can enter on a subform ?
Limit seems no solution.
This limits the number of rows displayed but not the number of rows that can be entered.
Thanks
Johan
Welcome to the nuBuilder Forums!
Register and log in to access exclusive forums and content available only to registered users.
Register and log in to access exclusive forums and content available only to registered users.
reduce the rows on a subform
Re: reduce the rows on a subform
Johan,
There is no default settings that can be changed on a subform to do what you have asked, however..
If you put this code in the JavaScript textarea of the form that holds the subform, you can restrict it to whatever you want.
you will need to change these 2 parameters in nuLoadThis()
limitRows(pSubformName, pMaximumRows);
Steven
There is no default settings that can be changed on a subform to do what you have asked, however..
If you put this code in the JavaScript textarea of the form that holds the subform, you can restrict it to whatever you want.
you will need to change these 2 parameters in nuLoadThis()
limitRows(pSubformName, pMaximumRows);
Code: Select all
function nuLoadThis() {
limitRows(pSubformName, pMaximumRows);
}
function limitRows(pSubformName, pMaximumRows){
var fldPrefix = Array();
fldPrefix[0] = '';
fldPrefix[1] = 'code'; //-- lookup code field
fldPrefix[2] = 'description'; //-- lookup description field
fldPrefix[3] = 'luup_'; //-- lookup button
fldPrefix[4] = 'cal_'; //-- calander button
var rowPrefix = Array();
var rowPrefix = nuSubformRowArray(pSubformName);
var totalCols = document.getElementById('columns' + pSubformName).value;
for(var r = pMaximumRows ; r < rowPrefix.length ; r++){
for(var c = 0 ; c < totalCols ; c++){
var fieldName = document.getElementById(pSubformName + c).value;
for(var p = 0 ; p < fldPrefix.length ; p++){
if(document.getElementById(fldPrefix[p] + rowPrefix[r] + fieldName)){
document.getElementById(fldPrefix[p] + rowPrefix[r] + fieldName).style.visibility = 'hidden';
}
}
}
}
}
Steven
Re: reduce the rows on a subform
Steven,
This works fine, thanks a lot.
Only the delete button stays visible.
I've tried to add fldPrefix[5] = 'delete'; //-- delete button but that's not correct.
Can you help me on that?
Thanks;
Johan
This works fine, thanks a lot.
Only the delete button stays visible.
I've tried to add fldPrefix[5] = 'delete'; //-- delete button but that's not correct.
Can you help me on that?
Thanks;
Johan
Re: reduce the rows on a subform
Here you go..
Code: Select all
function limitRows(pSubformName, pMaximumRows){
var fldPrefix = Array();
fldPrefix[0] = '';
fldPrefix[1] = 'code'; //-- lookup code field
fldPrefix[2] = 'description'; //-- lookup description field
fldPrefix[3] = 'luup_'; //-- lookup button
fldPrefix[4] = 'cal_'; //-- calander button
fldPrefix[5] = 'row'; //-- tickbox button
var rowPrefix = Array();
var rowPrefix = nuSubformRowArray(pSubformName);
var totalCols = document.getElementById('columns' + pSubformName).value;
for(var r = pMaximumRows ; r < rowPrefix.length ; r++){
for(var c = 0 ; c < totalCols ; c++){
var fieldName = document.getElementById(pSubformName + c).value;
//document.getElementById(rowPrefix[r] + fieldName).style.visibility
for(var p = 0 ; p < fldPrefix.length ; p++){
if(document.getElementById(fldPrefix[p] + rowPrefix[r])){
document.getElementById(fldPrefix[p] + rowPrefix[r]).style.visibility = 'hidden';
}
if(document.getElementById(fldPrefix[p] + rowPrefix[r] + fieldName)){
document.getElementById(fldPrefix[p] + rowPrefix[r] + fieldName).style.visibility = 'hidden';
}
}
}
}
}