Spring and JSP: post all options in multiselect, not only selected ones - html

I've build a JSP page that contains a form with two multiple select objects and several buttons to send the elements from one to other. When the user has finished choosing the elements, clicks on a button to submit the form.
The form data is encapsulated through commandName="mainForm" in the JSP to a java POJO class MainForm that represents that form.
The problem here is that the POSTed elements from the multiselect objects are only those who remain "selected" (in blue) when the user submits the form. Is there any clean way (without JQuery) to send all the options?
Thanks in advance!!

You should write a JS code on "onsubmit" event of form to programatically select all the options of multiselect. (Thus, making all options blue)
Like in jQuery,
$('#form #selectId option').attr('selected', 'selected');
I don't see better way of doing it.

Related

HTML: Multiple submit buttons in a form, each leading to a different python script?

How can I do this? Doesn't a form only have one action? What if I have 3 different buttons at the end of a form and each one invokes a different script? Much appreciated.
Something like this is possible, but not in pure html. You need javascript for that, because a html forms action is defined in the form tag, which accepts only a single action.
Using javascript however you can register differrent handlers for the click events of different submit buttons, thus send the forms data to different locations.

save all options of struts select element

I would like to implement a dynamic select element using struts. I need to allow the user to add option elements to a select element on a page, then save all options when the form is submitted, not just the selected option. As a matter of fact, I do not even care about the selected option once submitted.
For instance, when a user enters a page, the select element is populated by a collection in the form bean. The user can then add, edit or remove options in the displayed select element (via jQuery, javascript). Then, the updated set of options are sent to the server when the user submits the form.
Here is where I am starting:
<html:select property="myList">
<html:options property="myList"/>
</html:select>
Is there a neat clean way to do this with the struts tags?
The struts tag doesn't have anything to do with the problem. All it can do is generate an select box containing options retrieved from the form bean. The problem is that an HTML select box only submits its selected option(s). That's what it's for.
If you want to submit all the options, make your select box multi-selection, and make sure that all the options are selected before submitting the form (using JavaScript, in the form submit event handler).
Or if you want to keep the select box as it is, create a hidden field for every option of the select box before the form is submitted (still using JavaScript, in the form submit event handler).

Send data to CSS Modal Popup

I need to manipulate my Mysql data on:
I populate Mysql DB content on HTML table and every row have "EDIT" and "DELETE" buttons...(HTML "a" tags buttons)
When I click on "Edit" button a pure CSS3 Modal Popup is open, where I need to Edit a record on the row,
If I click on "Delete" button a pure CSS3 Modal Popup is open for delete record confirmation if the answer is "YES" proceed to delete the Record if the answer is "NO" should back to the parent page...
Populate a list of selected records is working. CSS3 Modal Popup is working...
The question is how can I send arguments to the Modal Popup to manipulate the data?
Could someone help with this.
Thanks.
The ways I would do this in no particular order:
Separate modals for every item on the table. Could be cumbersome, and is definitely not efficient, but would get the job done without using Javascript.
Javascript - Have a data-id and data-table attribute in the button. When clicked, populate the modal with Javascript via AJAX.
Javascript - Store table data in JSON array. Use above attributes to access specific elements of the JSON table object.
Javascript - Store the JSON object directly in the data attribute if possible and load up the modal when clicked.
Have a hidden <div> with all the content, and when the button is clicked, transfer the HTML to the modal.
Really there are many other ways to get it done. Pick one that looks easy, efficient, and safe, and give it a go. Post back here when you get stuck and we will be glad to help you.

submitting multiple forms with one submit button

I have an application where in a signed in user searches a database and is displayed a table of results. These results are basically listings of events. I give the user then, the privilege to "keep" or "discard" any event (using radio buttons beside each event).
Now however, I wish to implement a functionality whereby, the user at the end can click just one "update" button and all changes are affected (since keeping one button for each record will be very user unfriendly). That is, I am looking equivalently to submit multiple forms with just one submit/update button.
Is this possible ?
You need to use javascript, I suggest you using JQuery. Using AJAX you need to submit each form - this way page will not be redirected once you submit a form!
Then, within each forms assign individual IDs for each form. Then, assign your submit button an id for example mySubmit. Up next, add following code:
$('#mySubmit').click(function(){
// submit form1 by ajax...
// submit form2 by ajax...
});
You may see jQuery's http://api.jquery.com/jQuery.post/ for further information on how to submit a form using ajax.
As long as all of the radio buttons and submit button are part of the same form, you don't need to worry about submitting multiple forms because there won't be any. You can have multiple submit buttons in a single form, you can give them different values to know which button was clicked.
If you don't want to use jQuery then use javascript to form a list of data separated by say ~ character and set this string to some hidden field and submit using document.formx.submit()
You will need to parse the string on server side to get the data in correct format.

Oracle Forms : How to make a window/canvas/form the starting one

I have a school project where I have to make a small database application using Oracle Forms.
I have 4 forms in my application:
A login form
A main form
A form that is displayed after the new button is pressed on the main form
Another form that is displayed after the edit button is pressed on the main form.
I've created the forms in the mentioned way.
When I start the application, I want the login form to be the starting form. Now what starts first is the edit form (the last one created).
How can I manage that?
Thank you.
The form loads that canvas first which holds the first data block in the Object Navigator. So make sure that your login form block is first on the list.
You can also set the "First Navigation Data Block" in the Property Palette for the form to the desired block on the login form and it will display that first, overriding the first block in the other answer.