add a search text field to another filter function

C

css-discuss.org

I have added the 2 asterisks lines for the search field for
orderNumber ****:
This page is using YUI so its complicated to explain but the function
I need to change should be simple js.
--------------HTML-----------------------
<div id="filtersDiv">
**Order Number: <input type="text" id="filterOrderNumber"
name="filterOrderNumber" size="10" value="" />
** <input id="filterSearch"
type="submit" />
<ui>
<li id="process">ProcessCode: </li>
<li id="system">SystemCode: </li>
<li id="plant">Plant: </li>
</ul>
<input type="hidden" id="xmlStartDate" name="xmlStartDate" /></li>
<li>End Date: <input type="text" id="endDate" name="endDate" /><input
type="hidden" id="xmlEndDate" name="xmlEndDate" /> said:
<li><input id="filterSubmit" type="submit"></li>
</ul>
</div>
-----------------------
I added the 2nd filterClickHandler2 event to listen for the
searchOrderNumber field.

var filterClickHandler = function(){
YAHOO.log("filter clicked");
var xmlStartDate = YAHOO.util.Dom.get("xmlStartDate").value;
var xmlEndDate = YAHOO.util.Dom.get("xmlEndDate").value;
var plant = YAHOO.util.Dom.get("userPlant").value;
var submitType='filterSubmit';
loadSecondaryFilters(xmlStartDate, xmlEndDate, plant);
var configURL = getConfigURL(xmlStartDate, xmlEndDate,submitType);
loadDataTable(configURL);
};
YAHOO.util.Event.addListener("filterSubmit", "click",
filterClickHandler);


var filterClickHandler2 = function(){
YAHOO.log("orderNumber filter clicked"); //
var orderNumber = YAHOO.util.Dom.get("orderNumber").value;
var submitType='filterSearch';
var configURL = getConfigURL(submitType);
loadDataTable(configURL);
};
YAHOO.util.Event.addListener("filterSearch", "click",
filterClickHandler2);


I added the submitType var to the clickhandler functions.
Now I need to alter the function getConfigURL() to accomodate for
both filters.

function getConfigURL(xmlStartDate, xmlEndDate,submitType) { //
1_11_2012 jr added submitType
var plant = YAHOO.util.Dom.get("userPlant").value;
if ( submitType='filterSubmit'){

var configURL = "/XMII/Illuminator?Transaction=" +
CN.config.GLOBAL_DIR + "/Message%20Queue/
GetMessageQueue&Server=XacuteConnector&Mode=Query&RowCount=99999&OutputParameter=outputXML&Content-
Type=text/xml&key=message";
configURL += "&ST=" + xmlStartDate;
configURL += "&ET=" + xmlEndDate;
configURL += "&plant=" + plant;
if(hasValue("empNo")) {
configURL += "&empNo=" + YAHOO.util.Dom.get("empNo").value;
}
if(hasValue("processDD")) {
configURL += "&processcd=" + YAHOO.util.Dom.get("processDD").value;
}
if(hasValue("systemDD")) {
configURL += "&systemcd=" + YAHOO.util.Dom.get("systemDD").value;
}
if(hasValue("functionDD")) {
configURL += "&functioncd=" +
YAHOO.util.Dom.get("functionDD").value;
}
if(hasValue("pageDD")) {
configURL += "&page=" + YAHOO.util.Dom.get("pageDD").value;
}
if(hasValue("moduleDD")) {
configURL += "&module=" + YAHOO.util.Dom.get("moduleDD").value;
}
if(hasValue("statusDD")) {
configURL += "&status=" + YAHOO.util.Dom.get("statusDD").value;
}
return configURL;
} } else{
//key is changed to orderNumber
var configURL = "/XMII/Illuminator?Transaction=" +
CN.config.GLOBAL_DIR + "/Message%20Queue/
GetMessageQueue&Server=XacuteConnector&Mode=Query&RowCount=99999&OutputParameter=outputXML&Content-
Type=text/xml&key=orderNumber";
?????
return configURL}

Is this right?
Tnx,
Jan
 
C

css-discuss.org

On Jan 11, 7:06 pm, "css-discuss.org" <[email protected]>
Okay, I added the 2nd event listener function, first is for
filterSubmit and 2nd is for filterSearch.
Two separate filters. I modified the config function to incorporate
both events but there is a syntax error or a data error.
Can you please advise? Thanks.
var filterClickHandler = function(){
YAHOO.log("filter clicked");
var xmlStartDate = YAHOO.util.Dom.get("xmlStartDate").value;
var xmlEndDate = YAHOO.util.Dom.get("xmlEndDate").value;
var plant = YAHOO.util.Dom.get("userPlant").value;
loadSecondaryFilters(xmlStartDate, xmlEndDate, plant);
var configURL = getConfigURL(xmlStartDate, xmlEndDate);
loadDataTable(configURL);
};
YAHOO.util.Event.addListener("filterSubmit", "click",
filterClickHandler);


var filterClickHandler2 = function(){ //1_11_2012 jr added function
// YAHOO.log("orderNumber filter clicked");
var orderNumber = YAHOO.util.Dom.get("orderNumber").value;
var submitType=1;
var configURL = getConfigURL(submitType);
loadDataTable(configURL);
};
YAHOO.util.Event.addListener("filterSearch", "click",
filterClickHandler2);

function getConfigURL(submitType,xmlStartDate, xmlEndDate) {
var plant = YAHOO.util.Dom.get("userPlant").value;
if(submitType===undefined) { //clickHandler
var configURL = "/XMII/Illuminator?Transaction=" +
RN.config.GLOBAL_DIR + "/Message%20Queue/
GetMessageQueue&Server=XacuteConnector&Mode=Query&RowCount=99999&OutputParameter=outputXML&Content-
Type=text/xml&key=message";
configURL += "&ST=" + xmlStartDate;
configURL += "&ET=" + xmlEndDate;
configURL += "&plant=" + plant;
}else if(xmlStartDate===undefined &&
xmlEndDate===undefined) { //clickHandler2
var configURL = "/XMII/Illuminator?Transaction=" +
rn.config.GLOBAL_DIR + "/Message%20Queue/
GetMessageQueue&Server=XacuteConnector&Mode=Query&RowCount=99999&OutputParameter=outputXML&Content-
Type=text/xml&key=orderNumber";
configURL += "&plant=" + plant;
}
if(hasValue("orderNumber")){
configURL +="&orderNumber="
+YAHOO.util.Dom.get("orderNumber").value;
}
if(hasValue("empNo")) {
configURL += "&empNo=" +YAHOO.util.Dom.get("empNo").value;
}
if(hasValue("processDD")) {
configURL += "&processcd=" + YAHOO.util.Dom.get("processDD").value;
}
if(hasValue("systemDD")) {
configURL += "&systemcd=" + YAHOO.util.Dom.get("systemDD").value;
}
if(hasValue("functionDD")) {
configURL += "&functioncd=" +
YAHOO.util.Dom.get("functionDD").value;
}
if(hasValue("pageDD")) {
configURL += "&page=" + YAHOO.util.Dom.get("pageDD").value;
}
if(hasValue("moduleDD")) {
configURL += "&module=" + YAHOO.util.Dom.get("moduleDD").value;
}
if(hasValue("statusDD")) {
configURL += "&status=" + YAHOO.util.Dom.get("statusDD").value;
}
return configURL;
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,906
Latest member
SkinfixSkintag

Latest Threads

Top