I have three fields (docid
,docname
,docref
) in my database. I am able to display docname
starting with letter a successfully. The next step is to click any values from result, it should display other fields for that record.
For example I get alex
, adrain
, adams
as a result and when I click alex
it should show remaining fields (docid
,docref
) from the database.
Can anyone explain me the idea or samples or code? I have provided my code below, I need code or help for next step, I am stuck here, please.
Adapter
var sel = WL.Server.createSQLStatement("SELECT docname FROM docdb WHERE docname like ? ");
function getdoc(docname) {
return WL.Server.invokeSQLStatement({
preparedStatement : sel,
parameters :[new String(doc + "%")]
});
}
Adapter Invocation (client)
function searchfunc(){
var invocationData = {
adapter : 'docdb',
procedure : 'getdoc',
parameters : [$('#docname').val()]
};
WL.Client.invokeProcedure(invocationData,{
onSuccess : loadSQLSuccess,
onFailure : loadSQLFailure
});
}
function loadSQLSuccess(result){
displayresults(result.invocationResult.resultSet);
}
function displayresults(result){
var ul = $('#table');
for (var i = 0; i < result.length; i++) {
var li = $('<li/>').html(result[i].DOCNAME);
li.append($('<hr>'));
ul.append(li);
}
}
Search Form
To Search Based On DOCName <input type="text" id="docname" placeholder="name">
<input type="submit" value="Search" onclick="searchfunc();"><br><br>
<ul id="table"> </ul>
<input type="button" id="backButtonPage2" class="backbutton" value="BACK" onclick="currentPage.back();" />