Raw HTML in Form Filter - symfony1

At my company, we had developed a athletes management solution, were each athlete is inserted in the application by administrators users. For the referred solution, it was used the symfony admin generator.
On the second project iteration, one of the clients request was to turn the printed athletes list more legible. To accomplish that, we had created proper CSS styles, to be used when the user selects the browser print option.
However, the athletes form filter has some HTML tags (symfony widgets) whose do not render properly, namely, the select tag that has possible multiple choices (the select choices do not appear on the print preview).
So, I would to know if is possible to insert raw HTML directly on the form filter (get the selected options and convert them is labels or plain text), that will be only visible when the user selects the print option.

You could put a custom widget in place of the standard choice widget that adds in the values you want to be shown when printing but hidden with styles by default. Then you show them using your print style sheet.

Related

How do I get Grails g:select with multiple-selection with all selections when returning from the controller

I have a page that is a report from a database and I'm working on modifying how the filtering works. The intention is to allow the user to select possible values form a list that will be used to filter the resulting report. There are too many values to do this with checkboxes. I'm defining a multiple selection list box with this:
<g:select name="country" from="${countryDataList.KOUNTRY}" value="${params.country}" multiple="true" />
countryDataList is a List<> of objects with a name and a value which I create in the controller. I'm able to get the selected counties and process them without an issue.
But when the page returns from the controller with the filtered report, only the first selection in the list is selected. It doesn't re-select all of the items that the user selected. I am passing the params.country object back from the controller as
country:params.country
I saw some posts about this not working, but they are all from several years ago. Am I missing a vital step?
Ahh sorry, I was reading it on the phone initially and missed the point.
So what you want is a way of sending a multiple select box to a confirmation page. If I understand correctly?
Anyways how many objects in the select are we talking massive or a dozen couple of dozen or so ?
What I did was use check boxes and did a confirmation which shows the selection ticked in check boxes.. So this is the confirmation page that loads in https://github.com/vahidhedayati/mailinglist/blob/master/grails-app/views/mailingListEmail/confirmcontact.gsp
this page which is where multiple attachments selected from the schedule re-appear...
https://github.com/vahidhedayati/mailinglist/blob/master/grails-app/views/mailingListAttachments/_mailerAttachmentsDisplay.gsp.
Please note advice below is all conceptual stuff and there may be easier ways than this
Other than that You could create a taglib call on the confirmation page https://github.com/vahidhedayati/ajaxdependancyselection/blob/master/grails-app/taglib/ajaxdependancyselection/AutoCompleteTagLib.groovy#L55 which takes in your arrayList you could probably convert it to JSON pass it into the javascript that you load in within the taglib (on mine further down it loads this page in)
https://github.com/vahidhedayati/ajaxdependancyselection/blob/master/grails-app/views/autoComplete/_selectJs1.gsp#L23
and look to reselect them using javascript... as I say I haven't tested the last bit, the first bit i.e. checkbox works it is/has been in use.
Years later from you I just had the same problem. What I figured out is: it happens when params.country is an array instead of a Collection (i.e. an ArrayList).
A workaround for this if you want to stick to the array type is at the value attribute of the tag doing this: params.country?.findAll().

Grails. Select tag

I am using 2 select tags. Their content can be modified inside the web page(via javascript).
By default grails will take only the selected option (or all selected options if multiple is enabled) and pass it to the controller.
How could I pass to the controller all the available rows from a select box ?
Maintain a secondary hidden list which has all elements selected. Then this list will get sent as well?
Or I guess you could maintain a hidden form element containing some sort of delimited list of names (but then you might get problems choosing a delimiter and escaping the values)

Rails: many-to-one display on form via dynamically added input text boxes

I have a form in rails that allows the user to create a new object (call it a search).
This object has_many excluded_phrases.
What I would like is the ability to display one text box per excluded phrase added.
The form will start out with only a single text box, allowing the user to add one excluded phrase. If they want to add more, there will be button labeled "+" that will dynamically add one more text box, and allow the user to add as many more items as he wants.
On form submit, this should populate the db with the user search, and create all the required phrases that are linked to that user search.
Help?
All inspiration needed is there:
http://railscasts.com/episodes/197-nested-model-form-part-2
This popular rails plugin does exactly what you want.

Make collection_select display as an image (Rails 3 App)

All,
BACKGROUND: I have a collection_select statement that displays a dropdown box.
OBJECTIVE: I'd like the dropdown to be an image that the user clicks to see the collection rather than the default box + down arrow that appears.
You need something like this plugin for jQuery. It allows you to replace a normal select with a custom one based on your wants. You would have to write your own select helper since you need to add the attributes to the select options that this plugin requires. If you get started and need help, post back here with what you're stuck on.

How to get multiple and individual update actions on product lines in mvc?

I've got a list of products in an admin section of my website. I have the product title and then an icon for delete and an icon for set visible/set invisible. I have both icons wrapped in their own form elements so they fire seperate Actions. I now one to add some checkboxes to each line so I can do a bulk delete. Following this:
How to handle checkboxes in ASP.NET MVC forms?
I'd need to wrap the whole list in a form tag to return the checkbox values, but then I have the icons on each row wrapped in form tags. I'm not sure what to do or how to handle this so it all works. How can I maintain the line form tags but still get bulk update functionality?
It's probably going to require some JavaScript. I would create a form outside of the table with a hidden element. When a box is checked, update the hidden element to contain a comma-separated list of all the IDs for rows that have the checkboxes checked (this would be pretty straightforward with jQuery). When that form is submitted, parse the values of the hidden element and delete accordingly.
Another option is to wrap the whole thing in one form and make the names of the delete buttons unique, then check for that when the form is submitted. When doing a bulk delete, you'll have all the checkbox values submitted like normal and you'll know it's a bulk delete based on which button they pressed to submit the form.

Resources