August 06, 2015, 08:26 AM
Dr. Nick [SOLVED] Maintain - HTMLTable - Duplicate - JavaScript
Good Morning,
For "Maintain", does anyone have a JavaScript function to check the data source (stack) of an HTMLTable against a user entered string. This will be utilized to insure unique field description data. I tried a number of functions found on the web but none worked, for example:
function findInTable(str, tableID){
$('#' + tableID + ' tr').each(function(){
$(this).children('td').each(function(){
if ( $(this).html() == str ){
alert('found');
return false;
}
});
});
}
Where tableID = Formname.getElementById("HTMLTable1");
I'm working with WebFocus version 7.7.03 in a Windows environment.
Thank you,
Nick
This message has been edited. Last edited by: <Kathryn Henning>, August 13, 2015 12:39 PM August 07, 2015, 07:35 AM
Maintain Wizard Nick
Instead of trying to search the column in the HTMLTable, I would do this:
1) Create a string of all the values:
Compute I/I3=1;
Repeat Stk.Foccount
Compute Values = Values | stk(i).field;
Compute I=I+1;
Endrepeat
2) Place Values on the screen in an editbox with Visible set to no.
3) When the user enters the value to check use the JS command str.search
var val = Form1.Values_Edit.value;
var data = Form1.Entereddata_Edit.value
var n = str.search(data);
If you get a value for n then the data is found.
Mark