Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
dave ch
Liferay js not working
February 15, 2013 9:00 AM
Answer

dave ch

Rank: Regular Member

Posts: 164

Join Date: February 6, 2012

Recent Posts

Hi all,

I am trying to compare two var's in liferay js. But it's not working :

var currentEntries = instance.get('curEntries');
alert("currentEntries :" +currentEntries); // getting all entries like sam, john, kate
for(var i=0; i<currentEntries.length; i++){
var entries = currentEntries;
alert("entries :"+entries.type); // working under For loop

var text = instance.inputNode.val();
alert("text :" +text); // getting, the text i have recently entered

if(text.equals(entries))
{
alert("This Already Exist"); // This is not getting compared
}

The alert This Already Exist that suppose to come is not comming.
If this is not the right way, then, is there any other approach in liferay js. ?

Regards,
dave ch
RE: Liferay js not working
February 15, 2013 12:07 PM
Answer

dave ch

Rank: Regular Member

Posts: 164

Join Date: February 6, 2012

Recent Posts

Even the type it is showing as String. Then why these two strings are not getting compared.

alert(typeof entries ); //String
alert(typeof text); //String


Even i tried to compare them using Ascii

if(toAscii(text)==toAscii(entries))

but still they are different and not the same when compared.

Can any body hav any idea on this?

Regards
dave ch
RE: Liferay js not working
February 16, 2013 6:55 AM
Answer

dave ch

Rank: Regular Member

Posts: 164

Join Date: February 6, 2012

Recent Posts

Any One?