Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > add a search text field to another filter function

Reply
Thread Tools

add a search text field to another filter function

 
 
css-discuss.org
Guest
Posts: n/a
 
      01-12-2012
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>
<ul>
<li>Start Date: <input type="text" id="startDate" name="startDate" /
><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" /></li>
<li>empNo: <input type="text" id="empNo" name="emp" size="4" value="" /
></li>

<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
 
Reply With Quote
 
 
 
 
css-discuss.org
Guest
Posts: n/a
 
      01-12-2012
On Jan 11, 7:06*pm, "css-discuss.org" <janis.ro...@gmail.com>
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;
}

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
javascript validation for a not required field, field is onlyrequired if another field has a value jr Javascript 3 07-08-2010 10:33 AM
Feed another field (or pop-up a choice) in JSP when a field isentered a certain value Sébastien de Mapias Java 5 05-26-2009 08:35 PM
1.Enter space bar for field names and save the field.The field shoud not get saved and an alert should be there as"Space bars are not allowed" Sound Javascript 2 09-28-2006 02:43 PM
Validating a field based on value of another field Emmanuel ASP .Net 1 11-22-2005 12:35 PM
If value in name field in top row disable submit button until add button is pressed or field is cleared. Chuck Javascript 0 11-10-2003 02:23 AM



Advertisments