Hello, let's continue talking about writing some code in the view layer from back pain. Let's try to pick someone or component like input text if you want to user once a user enter some value to the input text, you want to write some code to catch if the value changes happen or not. So here if it goes to the value change listener of any input component, or input list of value. So here for example, once the users in in changing the department name, let's try to write some good. Here I will select the my bag bean I can say the name value change listener. As I said any listener it means you can write a code for this.
To get the new value entered you can select here soon Then you deep name is both get in your value and if you need to displace all the value before the chain user change and make some euro business you can do it okay. So, this is in case if you want to make some change for once a user makes a change here. Let us take another example on the morons application one time. So, for example, if you need to, for example, create a new row. So, I need to execute the Create insert if you go to here. And action listener you will find it is called create insert forms a binding.
So, if you go to binding here, you will find here create insert operation and this button is invoked this current insert In case you want to call this create insert operation from the but been not from here, so you will remove it from here okay and be sure this grid search is still here because sometimes if new usage of create insert operation, it will be deleted so just to be sure it's accurate insert is here. So here is action listener, I will overwrite Mr. Curry new dipped okay and then need to invoke this create insert. After I create a new row insert into department I can set some value to the department name or location ID or whatever. We can sit at the wall to location name or the working name So that you would be able to see you can get a current row and set the attribute.
So here I need to invoke the Create insert operation you have to get it from the big definition, create insert. Okay, so you have a mismatch here in the mind If you still don't execute operation and the gives the operation name is create insert. Okay, after create insert, I need to get the new row created row the blank row and they need to set some value. So how you get this roll. You can roll the new the true equal my EDF util dot first you have to get the current a traitor. Get at a trade okay From say traitor, you sit get the current row.
So I need the current row of the traitor. So we need a traitor name this what we are using cool. So I need to get the iterator and to get the current row you have to import zero should be Oracle de chivo Dutrow after you get now with the current row, you can sit attribute okay also departments you have to go to the department view and see what attribute you want to set I need to set the department name because if you try to enter attribute name which is not included in the view object, you will receive an error message so you have to set The bottoming team dipped and the value will be the name from back Okay, this is a way you can set a current row or you can use a straightaway off the record set my if you till don't sit at reviewed in a traitor and you can sit say traitor name and you can sit the attribute name and you can sit the value of your which you want to sit.
So you can use this straight away instead of getting the current through and says a tribute but I just wanted to explain you how you can get the current through from a trade on the back pain. So but actually we have already functional core set attribute in iterator since the return name, and attribute name and the value. If say 3332 iterator name not in the page definition you will get an error if the department or the attribute name is not part of the view object which is a three 2.2 it will give you get an error if the operation carried insert not exist here you would get an error. So you have be sure that anything you write in your back pain exists in the batch definition. Okay, so this is if you need to set some value once after you brisk written cert Of course we override we set a default value from some other layer.
If you remember that once you create overrides a create method is a view or limit or the entity level you can set some value but this is another way you can do it in the back beam. Okay, so now we had two singers on to make a change in that department name and the brisket eaten surgery will override this. Let's now try to run the page and see How is this two things will work okay. So, in the department name here we override override in the listener here is a value change listener we add some some we call market value JSON to a Mrs a bag bean, but actually let us see if we will see this or not. So if we make some changes here, okay, you will not see it here. Why?
Because this is the value here is a value change listener is still not can drop, it can't reach to the back bean unless you sit the submit to the true So be sure that any value change listener for any component uses the old submit the true so that the value will reach to the back been. Okay, so let's now try to refresh the game. And let's know to make it our So, now, if you can have a look into the look, you will find new the new IP name is what we get. So it's clear it again removes this or you will find here then you are deputy one coming from the model because we already received the model and this is coming from the back been new the new depth name is the new name is Okay, so now we can you can write some code wants the user make some change in with tickets and get out if you want to write some code.
You can do it in the value change listener okay another thing is a create insert, which we override the action listener to a method as a back beam. And I will invoke an operation called create insert and I will set a traitor to be the from back pain. So let's now try to escalate insert and see what will happen. Now, it is create a new row and it is set a dip name from back been which we wrote it. So this is how you can invoke operation in operation log like first even commit or rollback you can just call execute operation commit or rollback and how you can set value to the current row of a traitor. How you can see the value change listener on listener of the empathic historian but these two values, how you can write value change listener Next video, I will go for another example for how you can write a piece of code in the view layer.
So see you next time