How can I do it (checkboxes)?

Questions and answers for designing and implementing forms in Servoy

How can I do it (checkboxes)?

Postby log-out » Mon Nov 28, 2011 7:19 pm

Hi:

In my solution I have a Products Table (fields: product_id, product_name), a Sections table (fields: section_id, senction_name), a Subsections table (fields: subsection_id, section_id, subsection_name; related to Sections Table).

I can put every product in any section/subsection using a table, with this fields: product_id, section_id, subsection_id.

In Product Form I like to show (in a window) the sections/subsections where the product is, like this:

Image

Uploaded with ImageShack.us

In this window, the user can set/unset the sectiones where the product is, but I have no idea how to do it! :(

Any ideas? Thanks in advance!
Log-Out
Madrid - Spain

Servoy 5.2.9 - build 1020 - SQL Server 2005
Servoy 6.0.3 - build 1223
Java version 1.6.0_29-b11 (!!)
Windows XP Professional SP3
log-out
 
Posts: 180
Joined: Sat Feb 19, 2005 4:20 pm
Location: Spain

Re: How can I do it (checkboxes)?

Postby ROCLASI » Tue Nov 29, 2011 10:28 am

Hi Log-out,

You can check the values using code by putting the values in the dataprovider. If you want to check more values you need to delimit them by a return.
Keep in mind that if you use a valuelist with a real and display value you need to set the real value.

Hope this helps.
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Re: How can I do it (checkboxes)?

Postby log-out » Tue Nov 29, 2011 11:02 am

In that window I want to show all sections (all values in Sections table) and below every sections all its subsections (all values in Subsections table). Then, I would look for values in the "product-section-subsection" table and I'd check the values in the window.

But how I do it? What datasource I set for the window?

I'd tried to create an html area and put code in it (using <input type="checkbox" [...]>). It works for viewing, but I don't know how to trigger an action when the user selects a chekbox (it doesn't work: <input type="checkbox" onclick="a-method()">)
Log-Out
Madrid - Spain

Servoy 5.2.9 - build 1020 - SQL Server 2005
Servoy 6.0.3 - build 1223
Java version 1.6.0_29-b11 (!!)
Windows XP Professional SP3
log-out
 
Posts: 180
Joined: Sat Feb 19, 2005 4:20 pm
Location: Spain

Re: How can I do it (checkboxes)?

Postby david » Wed Nov 30, 2011 10:50 am

Untested idea: use three table-based value lists based on your sections table where the name of each value list corresponds to a main section value. Not sure about this part: display using three fields attached to the same data provider -- each field attached to a different value list. I'm thinking it should work as checkbox field types store and display comma-delimited values and don't display values not in the value list.

Use labels for your main section headings.

If your main sections are dynamic, do everything with solution model code.
David Workman, Kabootit

Image
Everything you need to build great apps with Servoy
User avatar
david
 
Posts: 1727
Joined: Thu Apr 24, 2003 4:18 pm
Location: Washington, D.C.

Re: How can I do it (checkboxes)?

Postby log-out » Wed Nov 30, 2011 11:16 am

Thanks, David, I'll try it.

You're right, my main sections are dynamic (records in a table), and now there're >50 records, so it's better to do it with solucion model core.
Log-Out
Madrid - Spain

Servoy 5.2.9 - build 1020 - SQL Server 2005
Servoy 6.0.3 - build 1223
Java version 1.6.0_29-b11 (!!)
Windows XP Professional SP3
log-out
 
Posts: 180
Joined: Sat Feb 19, 2005 4:20 pm
Location: Spain

Re: How can I do it (checkboxes)?

Postby jasantana » Wed Nov 30, 2011 3:09 pm

log-out wrote:You're right, my main sections are dynamic (records in a table), and now there're >50 records, so it's better to do it with solucion model core.


Hi logout, if you have 50+ records in your sections table I do not think that this is the best way for the user interface.

Thinsk about showing all the sections in a list form and another listform containing the subsections (of course related) you can put a check box to each list.

I would add an optiongroup to allow the user display: only marked records, only not marked records or both type of records.
Best regards,
Juan Antonio Santana Medina
jasantana@nephos-solutions.co.uk
Servoy MVP 2015
Servoy 6.x - Servoy 7.x - Servoy 8.x - MySQL - PostgreSQL - Visual Foxpro 9
User avatar
jasantana
 
Posts: 555
Joined: Tue Aug 10, 2010 11:40 am
Location: Leeds - West Yorkshire - United Kingdom

Re: How can I do it (checkboxes)?

Postby david » Wed Nov 30, 2011 6:03 pm

jasantana wrote:
log-out wrote:You're right, my main sections are dynamic (records in a table), and now there're >50 records, so it's better to do it with solucion model core.


Hi logout, if you have 50+ records in your sections table I do not think that this is the best way for the user interface.
[/quote]

I agree. Typically a merge table is used to handle this sort of thing. Allows you to track other data points like when a section was added to a project, other UI's can hook into the table, reporting is easier, handle way more records(!), etc.

I like the idea though. Intriguing UI pattern if you don't need all the other stuff.
David Workman, Kabootit

Image
Everything you need to build great apps with Servoy
User avatar
david
 
Posts: 1727
Joined: Thu Apr 24, 2003 4:18 pm
Location: Washington, D.C.

Re: How can I do it (checkboxes)?

Postby log-out » Wed Nov 30, 2011 6:25 pm

jasantana wrote:Thinsk about showing all the sections in a list form and another listform containing the subsections (of course related) you can put a check box to each list.


This approach sounds better, but if I use sections table as datasource of sections list form and subsections table as datasource of subsections sub-list form, how can I check/uncheck the subsections if that info is in "product-section-subsection" table?

Thanks!
Log-Out
Madrid - Spain

Servoy 5.2.9 - build 1020 - SQL Server 2005
Servoy 6.0.3 - build 1223
Java version 1.6.0_29-b11 (!!)
Windows XP Professional SP3
log-out
 
Posts: 180
Joined: Sat Feb 19, 2005 4:20 pm
Location: Spain

Re: How can I do it (checkboxes)?

Postby david » Wed Nov 30, 2011 6:32 pm

Merge table!
User avatar
david
 
Posts: 1727
Joined: Thu Apr 24, 2003 4:18 pm
Location: Washington, D.C.


Return to Forms

Who is online

Users browsing this forum: No registered users and 4 guests

cron