How to compare string in a case-insensitive manner using JavaScript?
Hello everyone,
Now I have a javascript to compare checkbox's value with user's input, but now seems it only can compare case-sensitively, does some one know if there is a function in javascript that it can compare string case-insensitively ?
Here is my script :
function findOffice(field)
var name;
name=prompt("What is the office name?");
var l = field.length;
for(var i = 0; i < l; i++)
if(field.value==name)
field[i].checked=true;
field[i].focus();
field[i].select();
break;
<input type="button" name="Find" value="Find And Select" onClick="findOffice(form1) >
Thanks in advance !
Rachel
Thank you so much, I already solved the problem with your advice.
You really have a beautiful mind, :-).
I appreciate your help !
Rachel
Similar Messages
-
Hi,
The requirement is to create ""Document Sets in Bulk" using JSOM. I am using the following posts:-
http://blogs.msdn.com/b/mittals/archive/2013/04/03/how-to-create-a-document-set-in-sharepoint-2013-using-javascript-client-side-object-model-jsom.aspx
http://social.msdn.microsoft.com/Forums/sharepoint/en-US/1904cddb-850c-4425-8205-998bfaad07d7/create-document-set-using-ecma-script
But, when I am executing the code, I am getting error "Cannot read property 'DocumentSet' of undefined "..Please find
below my code. I am using Content editor web part and attached my JS file with that :-
<div>
<label>Enter the DocumentSet Name <input type="text" id="txtGetDocumentSetName" name="DocumentSetname"/> </label> </br>
<input type="button" id="btncreate" name="bcreateDocumentSet" value="Create Document Set" onclick="javascript:CreateDocumentSet()"/>
</div>
<script type="text/javascript" src="//ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.2.min.js"> </script>
<script type="text/javascript">
SP.SOD.executeFunc('sp.js','SP.ClientContext','SP.DocumentSet','SP.DocumentManagement.js',CreateDocumentSet);
// This function is called on click of the “Create Document Set” button.
var ctx;
var parentFolder;
var newDocSetName;
var docsetContentType;
function CreateDocumentSet() {
alert("In ClientContext");
var ctx = SP.ClientContext.get_current();
newDocSetName = $('#txtGetDocumentSetName').val();
var docSetContentTypeID = "0x0120D520";
alert("docSetContentTypeID:=" + docSetContentTypeID);
var web = ctx.get_web();
var list = web.get_lists().getByTitle('Current Documents');
ctx.load(list);
alert("List Loaded !!");
parentFolder = list.get_rootFolder();
ctx.load(parentFolder);
docsetContentType = web.get_contentTypes().getById(docSetContentTypeID);
ctx.load(docsetContentType);
alert("docsetContentType Loaded !!");
ctx.executeQueryAsync(onRequestSuccess, onRequestFail);
function onRequestSuccess() {
alert("In Success");
SP.DocumentSet.DocumentSet.create(ctx, parentFolder, newDocSetName, docsetContentType.get_id());
alert('Document Set creation successful');
// This function runs if the executeQueryAsync call fails.
function onRequestFail(sender, args) {
alert("Document Set creation failed" + + args.get_message());
Please help !!
Vipul JainHello,
I have already tried your solution, however in that case I get the error - "UncaughtSys.ArgumentNullException: Sys.ArgumentNullException:
Value cannot be null.Parameter name: context"...
Also, I tried removing SP.SOD.executeFunc
from my code, but no success :(
Kindly suggest !!!
Vipul Jain -
How to pass a single quote in a URL using Javascript
Can someone tell me how to pass a single quote in a URL using Javascript. I have created a Javascript funciton in which I pass several column values from an APEX report.
The URL for the report link I am using is "JAVASCRIPT:passBack('#EMP_ID#','#Name#','#e-mail#')"
The problem occurs with the Name and e-mail columns contain a single quote (i.e. James O'Brien)Thank you Saad, that worked.
Since I built the report using type 'SQL Query (PL/SQL function fody returning SQL query)' I had to add some additional quotes to get it to work.
i.e.
replace(EMP_EMAIL_NAME,'''''''',''\'''''')
or
replace(EMP_EMAIL_NAME,chr(39),''\'''''')
Thanks for the help,
Jason -
How can I attach a PDF in an email, using javascript in PDF document?
How can I attach a PDF in an email, using an interactive button in the PDF-document?
I tried to create a form button with the menu action 'attach this PDF in an email'.
This Send.to-action doesn't work with Microsoft.
Does anyone has a solution by implementing a javascript-code for this in the PDF?Dick,
Thanks for your replie.
Nice alternative, but it still doesn't work on a Windows machine when the
mail software from Microsoft doesn't react on PDF actions.
You can do many things in Acrobat, but it is a problem when it doesn't work
on Windows and iPad.
So now I am looking for alternatives like interactive magazine software
(based on html5).
2012/5/11 dick the flash <[email protected]>
Re: How can I attach a PDF in an email, using javascript in PDF
document?
created by dick the flash <http://forums.adobe.com/people/dicktheflash>in
JavaScript - View the full discussion<http://forums.adobe.com/message/4395927#4395927 -
How to Read Variable Values in WAD 7.0 Using JavaScript
I found a how to: How to Read Variable Values in WAD 7.0 Using JavaScript on SDN.
I get a Javascript error:
bics.getElementsByTagName is not a function
vars = bics.getElementsByTagName("VARIABLES")[0]; // <VARIABLES>
Thats my script:
function currency()
var varnm = "SFS_CP_CURR"; // Name of the variable to be read
root = document.childNodes[0]; // <HTML>
body = root.getElementsByTagName("BODY")[0]; // <BODY>
xml = body.getElementsByTagName("XML")[0]; // <XML>
bics = xml.childNodes[0]; // <BICS_VIEW>
vars = bics.getElementsByTagName("VARIABLES")[0]; // <VARIABLES>
varl = vars.getElementsByTagName("VARIABLE"); // gives no. of variable in DP
for ( i = 0; i <= varl.length; i++ ) // Loop one by one
vari = vars.getElementsByTagName("VARIABLE")<i>;
varnam = vari.attributes[0].text; // get variable name
mem = vari.getElementsByTagName("MEMBER")[0];
varval = mem.attributes.getNamedItem("name").value; // read variable value
if (varnam == varnm) //check varname in loop needs to be read
if (varval == "ZMON") // check for value1 and fire command1
SFS_CP_M();
if (varval == "ZKON") // check for value2 and fire command2
SFS_CP_K();
break;
Where's the mistake?I'm afraid I haven't made my question understood clearly.
What I am looking for is a method to get the value of variable inside excel (e.g. put it into a cell / range of a worksheet, so that we can reference it and use it as an input for planning function execution).
Please advice.
Thanks in advance,
Shady -
How to find the font and replace another font using javascript in illustrator?
Dear All,
how to find the font and replace another font using javascript [batch process] in illustrator?
i have 700 image file, it very deficult replace one by one.
regards,
.Suresh.SAsk the creator of the file for a unprotected version.
-
How to make MySQL JDBC Driver case-insensitive
Hi,
I'm porting a jdbc application from oracle to mysql. One of the problem is that oracle's column names are case insensitive, whereas CODE in mySql is different from code (see example posted below).
I know that I can change the source code to use always the same case. But is there a way to make the mysql jdbc driver case-insensitive ?
import java.sql.*;
/* getString(String) is case sensitive for org.gjt.mm.mysql.Driver driver */
mysql> describe currency;
+-----------------+----------------+------+-----+----------------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------------+----------------+------+-----+----------------+-------+
| code | char(3) | | PRI | | |
| name | varchar(40) | | UNI | | |
| shortCode | char(2) | YES | MUL | NULL | |
| exchangeRate | decimal(19,12) | | | 0.000000000000 | |
| changed | decimal(1,0) | | | 0 | |
| markedFlag | decimal(1,0) | | | 0 | |
| updateTimestamp | timestamp(14) | YES | | NULL | |
+-----------------+----------------+------+-----+----------------+-------+
7 rows in set (0.00 sec)
getObject(1)=EUR
Trying code
getObject("code")=EUR
Trying Code
java.sql.SQLException: Column 'Code' not found.
at org.gjt.mm.mysql.ResultSet.findColumn(ResultSet.java:1213)
at org.gjt.mm.mysql.ResultSet.getObject(ResultSet.java:1188)
at mySqlDemo.main(mySqlDemo.java:61)
getObject(1)=USD
Trying code
getObject("code")=USD
Trying Code
java.sql.SQLException: Column 'Code' not found.
at org.gjt.mm.mysql.ResultSet.findColumn(ResultSet.java:1213)
at org.gjt.mm.mysql.ResultSet.getObject(ResultSet.java:1188)
at mySqlDemo.main(mySqlDemo.java:61)
public class mySqlDemo {
public final static void main(String[] args) {
try {
/*== database constants ==*/
String DBHOST = "localhost";
String DBNAME = "test";
String DBUSER = "test";
String DBPASS = "";
String DBDRIVER = "org.gjt.mm.mysql.Driver";
/*== setup database driver and connect ==*/
Class.forName(DBDRIVER).newInstance();
String conurl = "jdbc:mysql://"+DBHOST+"/"+DBNAME;
Connection db = DriverManager.getConnection(conurl,DBUSER,DBPASS);
/*== create sql query and execute ==*/
//String sql = "select code from currency";
String sql = "select Currency.code, Currency.name, Currency.shortCode, Currency.exchangeRate, Currency.changed, Currency.markedFlag, Currency.updateTimestamp from Currency order by code";
Statement stmnt = db.createStatement();
ResultSet rs = stmnt.executeQuery(sql);
/*== display results ==*/
while(rs.next()) {
System.out.println("getObject(1)=" + rs.getObject(1));
// works, because "Currency.code" has been selected
System.out.println("Trying code");
try {
System.out.println("getObject(\"code\")=" + rs.getObject("code"));
} catch(SQLException ex) {
ex.printStackTrace();
// case sensitive !
// does not work, because "Currency.code" has been selected
// "code" != "Code"
System.out.println("Trying Code");
try {
System.out.println("getObject(\"Code\")=" + rs.getObject("Code"));
} catch(SQLException ex) {
ex.printStackTrace();
} catch(Throwable t) {
t.printStackTrace();
}One of the problem is that oracle's column names are
case insensitive, whereas CODE in mySql is different from code (see example posted below).I doubt that.
SQL standards are rather specific that columns names are case insensitive unless quoted identifiers are used. And presumably you are doing that.
What you are seeing is a difference in drivers not databases.
I would guess that the only way to change the behaviour is to modify your code. If you uppercase everything it should work. Or you could use positional rather than named column extraction. -
How to change Database server is case-insensitive setting at runtime
Is there a way to change any of the properties in Report Options > General Settings at runtime. Mainly the [Database server is case-insensitive] and [Perform grouping on server] settings. We are using the Crystal .Net X1 runtimes (11.5.9707.811). I have sesrched the forums with no luck so thought I'd try my luck here. Thankyou for your time.
Hi Simon,
Sorry, search for the function using the Object Browser in .NET. If you have Crsytal Reports XI R2 (11.5.x.xxxx) then you have it. Unless it's not a developer version. In whcih case you need to upgrade.
If you do have the Developer version then simply add the RAS assemblies to your project. Look in our samples above for more info on h ow to use RAS.
If you don't have the Developer version then your only options are to upgrade or manually change the report settings in the Designer.
Thank you
Don -
Making ADF Search case insensitive without using Execute with Params??
I have a ADF search page baed on VO. I'm not Execute with Params form, instead i'm using normal ADF search page. Is it possible to make the search case insensitive?? if yes, how to do that?
Ok, i'll try to find out the SRDemo application using ADF BC.
And In Execute with params form,i'm already using UPPER on both the sides of where clause.
Say my VO query is like
select <table name>,...
from fnd_tables t,fnd_applications a
where a.application_id = t.application_id
and upper(t.table_name) like upper(:EntityName) || '%'
Then i created the ADF paramaters form by dragging and dropping the Execute with param from data control pallette.. when i run this page and do the search, it throws the error given in my second update...Any clue why that error is coming?
Thanks
Senthil -
Implement QBE case insensitive search using model layer?
Using ADF 11.1.1.6.2
We know we can set filterFeatures='caseInsensitive' at UI layer to make QBE to search case insensitive.
How can we push that behavior using model layer implementation?
ThanksUsing ADF 11.1.1.6.2
We know we can set filterFeatures='caseInsensitive' at UI layer to make QBE to search case insensitive.
How can we push that behavior using model layer implementation?
Thanks -
How to compare 2 arrays with different operator options using parameters in Teststand
Pls let me know how to compare 2 arrays using different operators like <= or >= or ==......
I am using TS 2010. FYI
ex:
Array XX [ A_Temp,
B_Temp,
C_Oil Pressure,
D_Oilpressure,
Note : A_Temp, B_Temp,C_Oil Pressure,D_Oilpressure all these parameters will be getting numerical values (dynamically) from the simulink models and also in future I may need to add parameters to this array.
Array YY [A_Temp_1,
B_Temp_2,
C_Oil Pressure_3,
D_Oilpressure_4,
Note : A_Temp_1, B_Temp_2,C_Oil Pressure_3,D_Oilpressure_4 all these parameters will be getting numerical values (dynamically) from the simulink models
So my question :
I would like to verify A_Temp >= A_Temp_1
B_Temp >= B_Temp_2
C_Oil Pressure >= C_Oil Pressure_3 etc -
Hi Folks,
I have list library with 2 columns. where as 1 column is people picker control and it is not mandatory filed .
When the user open newform.aspx and fill all the column values and submit it should show error message if user not enter any data in people picker control column though it is not a mandatory column.
How to achieve this by using javascript or sharpoint designer.Hello,
Here is script for that:
http://social.msdn.microsoft.com/Forums/en-US/f1c2a651-a0fb-484d-af33-e7084439b6c8/validate-sharepoint-people-picker-using-javascript?forum=sharepointgeneralprevious
http://ankursharepoint.blogspot.in/2012/10/javascript-validation-of-people-picker.html
Edit your newform.aspx page and add content editor webpart on that page. Then add script on HTML source section.
Hope it could help
Hemendra:Yesterday is just a memory,Tomorrow we may never see
Please remember to mark the replies as answers if they help and unmark them if they provide no help -
How to Insert user selected files as list attachment using JavaScript?
I could able to Inset list items using ECMA Script, But for the user added attachment how to save it to list item.
Please helpcheck the similar post
http://social.msdn.microsoft.com/Forums/sharepoint/en-US/3d92510f-f966-45b2-989d-734ba21c5ce5/how-to-attach-file-to-list-item-using-javascript-in-sharepoint-2010?forum=sharepointcustomizationprevious
More links
http://sharepoint.stackexchange.com/questions/88487/using-sharepoint-client-api-to-upload-file-as-attachment-in-javascript
http://sharepoint-community.net/forum/topics/copy-attachments-of-sharepoint-list-item-to-a-document-library -
How to get text from column labels in pivot using javascript?
Hi, is it possible to get text from column labels in pivot using javascript? How?
You don't get a response from a URLRequest, you get the response from a URLLoader:
View this sample page for URLRequest and URLLoader and I think it'll make more sense to you.
http://help.adobe.com/en_US/air/reference/html/flash/net/URLRequest.html#URLRequest() -
Newbie Question: Rules: Functions: How to compare String based type?
I have some XML facts in my rules dictionary defined by the following schema (fragments shown)
<xs:simpleType name="VarType">
<xs:restriction base="xs:string">
<xs:enumeration value="Foo"/>
<xs:enumeration value="Bar"/>
<xs:enumeration value="Baz"/>
<xs:enumeration value="Qux"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="ProgType">
<xs:sequence>
<xs:element name="ID" type="xs:string"/>
<xs:element name="var" type="VarType" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
Which means that a Prog of ProgType has an ID and a "list" of "var" strings restricted to bounds specified by VarType.
The issue comes when I try to create a Rules Function operating on these types.
Function-> boolean containsVar(ProgType prog,VarType var) (built using the Functions tab of the Rules editor)
for (String v : prog.var ){
if (v == var){
return true
return false
The problem we run into here is typing. If v is declared a String, as here, then v == var is invalid because types don't match. But I can't declare v a VarType due to
RUL-05583: a primitive type or fact type is expected, but neither can be found.
This problem may stem from the fact the Java's String is declared final and can't be subclassed, so the JAXB translation to Java may have to wrap it, futzing ==/equals() in the process.
SO... How do I create this method and compare these values?
TIA
Edited by: wylderbeast on Mar 10, 2011 9:15 AM - typos
Edited by: wylderbeast on Mar 10, 2011 9:18 AMAnd here's the answer.
var.value() seems to return the String value of the type
so the comparison becomes
(v == var.value())
Live and learn....
Maybe you are looking for
-
I added the wish list feature from amazon on my toolbar, but when I restarted my computer there wasn't any background pattern. I had a christmas scene backgound.
-
ORA-00064 after changes processes, open_cursors in Oracle 10g Express
Hi, I just run the following sql statements: alter system set processes=400 scope=spfile; alter system set open_cursors=5000 scope=spfile; After restart my computer, I can't connect to the oracle and in oradim.log i see the following error: ORA-00064
-
Production database sync with Reporting Server
we have configured always-on on node1 as primary and node 2 as secondary.Now I have launched a new node 3 SQL Server for reporting purpose.I want to have the node 1 Database to be in sync with node 3 Reporting server. As I dont want any overhead on t
-
Interfacing to a third-party system through a shared SQL Server DB Table
Guys, I have been given a task of interfacing to a third-party system through a shared SQL Server database table.I had never come across such implementation.Can anyone please let me know the methodologies involved in it. Thanks, Jack.
-
My Bridge in Adobe CC 2014 did not install
My Bridge did not install Photoshop CC