ui object does not exist after PrimeFaces.ajax.AjaxRequest call

UI Components for JSF
Post Reply
ronaldoronaldinho
Posts: 10
Joined: 12 Oct 2017, 10:06

19 Oct 2017, 08:32

hi, sir, I have implemented custom js function to onclick of one UI button.
password is one inputSecret object on the form.
I have that after the ajax call , inside onsuccess function, this.password object does not exist (i.e. == null), why?

Code: Select all

function loginClick()
	{	
		//do something
		PrimeFaces.ajax.AjaxRequest({	 	 	  
	 	 	  source:'btnLoginId2'	 	         
	 	 	  ,update:'loginFormGrowl'	 	 	  	 	 	   
	 	 	   ,onsuccess:function(data, status, xhr, args) {
	 	 	   		var responseXML = xml2Str(data);	 	 	   		
	 	 	   		var wrongPasswordKeyWord = "wrong Password !";
	 	 	   		var wrongPassword = responseXML.includes(wrongPasswordKeyWord);	 	 	   		
	 	 	   		if(wrongPassword)
	 	 	   		{
	 	 	   			//do something
	 	 	   		}	 	 	   		
	 	 	   		if(this.password != null)
					{
						//do something
					}
					else
					{
						
					}	   		
	 	 		} 	 	 	
	 	 	   }
	 	 	 );
	}

ronaldoronaldinho
Posts: 10
Joined: 12 Oct 2017, 10:06

19 Oct 2017, 08:58

hi, resolved. just do it outside ajax code block.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 54 guests