Welcome to the nuBuilder forums!

Please register and login to view forums and other content only available to registered users.

Multiple select using Listbox

Post Reply
Richsurvey
Posts: 12
Joined: Fri Sep 11, 2015 7:50 pm

Multiple select using Listbox

Unread post by Richsurvey »

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!
admin
Site Admin
Posts: 2791
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 4 times

Re: Multiple select using Listbox

Unread post by admin »

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
Post Reply