Multiple select using Listbox

Multiple select using Listbox

Postby Richsurvey » Sat Apr 09, 2016 2:34 am

Hi,

I'm using a listbox object for a multiple select value. Everything is working fine (SQL query, saving to database and displaying works).

My issue is that I want it to be easily readable on the Browse screen. Based on the document here: http://wiki.nubuilder.net/nubuilderv3/i ... istbox_Tab

The multiple select listbox is "saved as a string delimited by #nuSep#" - which is what is happening, but I want it to be separated by a line break (<br>) on the Browse screen.

Also, is it not best to save the values in the database delimited using comma opposed to '#nuSep#'? - the delimited issue is not a big problem; I just want to make sure that later on I'm able to easily run a query on that field (e.g. see how many users selected Feb).

Example of what I'm doing and what is happing:
In the 'Listbox' Tab I have a very similar SQL statement: SELECT customer_id, cus_name FROM customer

cus_name has the following value:
Adam
David
Eve
Daniel
Jacob

If a user selects the first 3 names -> it gets saved in the database as: Adam#nuSep#David#nuSep#Eve (preferable I want it to be saved as Adam,David,Eve - BUT ONLY if it's easier to run a query on this later on).

In the Browse screen the values are displayed as Adam#nuSep#David#nuSep#Eve -> but I want it to be displayed like the following:
Adam
David
Eve

I've also read that maybe using a listbox for a multiple select might not be the best solution (suggestion was to use a Subform instead??)

Please let me know if there is a solution, but if not, any help that can be provided is greatly appreciated.

Thanks!
Richsurvey
 
Posts: 12
Joined: Sat Sep 12, 2015 3:20 am

Re: Multiple select using Listbox

Postby admin » Mon Apr 11, 2016 2:03 pm

Richsurvey,

nuBuilder will only save listboxes with #nuSep#.

If you want to manipulate this string you can use..

implode or explode in PHP

and join or split in javascript.

Steven
admin
Site Admin
 
Posts: 3234
Joined: Mon Jun 15, 2009 9:53 am


Return to General