Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!

Karolis Kalanta

Greenhorn
+ Follow
since Nov 13, 2014
Karolis likes ...
Android Eclipse IDE MySQL Database
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Karolis Kalanta

Tim Holloway wrote:"onsubmit" is a javascript attribute corresponding the the HTML FORM onsubmit javascript attribute. It does not execute any Java code on the server, only Javascript code on the client.

As I mentioned, JSF dialog boxes are not OS-level dialog boxes. In essence, they are overlay HTML DIV elements that can be displayed or hidden over the top of the rest of the HTML page. It's all done in Javascript, no server-side code is involved and no separate dialog window pops open.

The Primefaces Dialog control has to be paired with a JSF h:form control, I forget which one has to contain the other, but it's in the documentation. The dialog JSF form works like any other JSF h:form in that in order to submit the form, and thereby trigger a JSF action method, you have to either use a JSF command control (h:commandButton, h:commandLink) or use AJAX. For command controls, the 'action=' attribute defines a reference to a backing bean method. NOT a method call. JSF does the actual method call, not the form. Thus: 'action="#{myBean.loadComponents}"', which would cause the backing bean's "public String loadComponents()" method to be invoked when the button or link was clicked.

AJAX operation is similar, except that instead of specifying a "public String method()" action method, you specify a reference to an AJAXListener method, whose signature is something like "public void myListener(AjaxEvent event)".

A full form submit (commandButton/commandLink) causes the entire form's input control values to be sent to the server, and if they are valid, the backing bean updates their corresponding properties, the action method is invoked, and then JSF navigates to whatever page the action method returns a reference to. Which, if it's null, would be the same page. Or, if the action is "immediate", the property validation and updating is skipped and the action method is invoked directly.

An AJAX submit is essentially the same process except that you can limit what input values from the form will be submitted and instead of rendering a fresh copy of the page, you can indicate that only selected parts of the current page should be updated.

Finally, note that when you display a primefaces dialog, all that's actually happening is that Javascript is making an existing DIV visible. The contents of that displayed DIV - including its control values - will be whatever they were when the page was initially displayed unless you have some sort of JavaScript or AJAX logic that updates them,



Well that's what I'm trying to use, running ajax event to update the list, but from your answer I understood that I need a function in js to do that, since ajax is working only half way.
5 years ago
JSF
Thanks for the reply,

Regarding the form, I need it to load the method when a request is sent so i guessed onsubmit was the most logical option.
The point of this for it to be in a dialog box, so I can't really put it outside of it.

What would be your alternative suggestions?
5 years ago
JSF
Common cowboys..
5 years ago
JSF
Hey code farmer, I have a dropDownList a.k.a. selectOneMenu and the user can add values to it. My problem is that it updates only when two values are added and only the pre-last value shows up. f.e. if you add "test" nothing shows up... if you add "test2", then "test" will show up on the list... if you add "test3", then "test2" will show up on the list and so on and so forth. What my problem is I need to figure it out how to add a value and show it on the list right away. Waiting for suggestions !

---HTML code---



---Java code---

5 years ago
JSF
Hi there,

Have a website where the user is prompted to input some text and select some values from a list which shows inputs from the database. My problem is that I'm trying to figure out how to copy the inputs from the first popup to another one which is a resume for the user to check his input. It's interesting because chrome shows that it works but eclipse browser does not and since I only want to assign the inputted values to my java variables after the user is sure that he is finished, I must copy the inputted values to the resume dialog box and then assign the values there.


---XHTML code---


---Jquery code---


---Area2 code--

5 years ago
JSF
Hey Robbins,

Thanks for the welcoming, but I think it would be better if you would delete the post, as I failed to located the edit button and I will try a different approach as I spent countless hours for this issue.
5 years ago
JSF
Dear JavaRanch cowboys,

I am new to JSP, JSF, javascript and primefaces (web app development in general) so please, don't bully me. I would like you to present you with my project. My project consists of a web app where a user can select a area from a picture and f.e. if it is a office layout he can input the worker name and any peace of hardware that the area might have. In this case there are two categories: Hardware and Computer. Hardware - it has 5 dropdown lists consisting of printer, scanner and etc. Computer - like Hardware consists of many dropdown lists which add up to components such as processor, motherboard and etc. For me, considering this is my first ever web app project, is a huge step towards web development, I have used various mixes of Java, javascript and primefaces code.
My current problem: When a user selects an area he gets a dialog box where he is prompted to select his desired input, afterwards the user clicks the 'save' button and get's another dialogbox which has a resume of what he has selected so he could check out his input and save it by clicking the 'save' button in the resume box. My problem is that when the user clicks the save button the button calls a method which takes all the input and creates an Area object (Area object consists of various objects such as: Coordinates, Dimensions, Employee, ComputerList and HardwareList) and sends a query to the database, but all the values I get is null.

XHTML code:



SendInput class:



5 years ago
JSF