Hey everyone,
I need your help with an issue that I am having. I am trying to get the Multi-CheckBox feature to work in my application but it isn't working properly.
I have it setup as dynamic and linking to a questions table in my SQL database. The Webmaker form and SQL pull the questions from the database and displays them correctly. When I go to save them using the CSV string bindings options, the form and SQL stores all the checked questions questioncodes into my checkedquestions field in my questions table. My SQL when executed in the Retrieve controller pulls the CSV string from my database and hands it off to the form but the form will not display the values as checked on my form and the form displays no checks just the questions.
Do any of you have any documents, training material or help me in any way to get this feature to work. People have said they have had issues with them in the 3.x series of WM but I am using WM 4.0 and most people have said they haven't tried it in WM 4.0. Any help will be really appreciated.
I need your help with an issue that I am having. I am trying to get the Multi-CheckBox feature to work in my application but it isn't working properly.
I have it setup as dynamic and linking to a questions table in my SQL database. The Webmaker form and SQL pull the questions from the database and displays them correctly. When I go to save them using the CSV string bindings options, the form and SQL stores all the checked questions questioncodes into my checkedquestions field in my questions table. My SQL when executed in the Retrieve controller pulls the CSV string from my database and hands it off to the form but the form will not display the values as checked on my form and the form displays no checks just the questions.
Do any of you have any documents, training material or help me in any way to get this feature to work. People have said they have had issues with them in the 3.x series of WM but I am using WM 4.0 and most people have said they haven't tried it in WM 4.0. Any help will be really appreciated.
RE: Help with WM 4.0 Multi CheckBox Feature
I+?+?+?m sorry you are having issues with the multiple checkbox control.
From the information you have provided it looks like you have everything configured correctly, and the fact that it is correctly submitting the CSV string backs this up.
I have just tried to do some testing with this control, and seem to have replicated the problem you are seeing. If I use the +?+?++XML Structure+?+?+? data format option it seems to work fine, but with the +?+?++CSV String+?+?+? setting the selected values do not seem to get shown correctly.
We will investigate further into what is causing this, but I think the best option for you would be to add some additional processing to convert the data retrieved from the database into a format that the control will process correctly.
To do this, open the rules for controller that performs the select query on the database, and add a new rule to fire after the database one.
Add a Transform action to this new rule, and create a new XSL file with the following content:
<xsl :s tylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="*[local-name() = 'YOUR_CSV_FIELD_NAME_HERE']"> <xsl:call-template name="split-csv-value"> <xsl:with-param name="string" select="."/> <xsl:with-param name="elemName" select="name()"/> <xsl:with-param name="elemNS" select="namespace-uri()"/> </xsl:call-template> </xsl:template> <xsl:template name="split-csv-value"> <xsl:param name="string"/> <xsl:param name="elemName"/> <xsl:param name="elemNS"/> <xsl:choose> <xsl:when test="contains($string, ',')"> <xsl:element name="{$elemName}" namespace="{$elemNS}"> <xsl:value-of select="substring-before($string, ',')"/> </xsl:element> <xsl:call-template name="split-csv-value"> <xsl:with-param name="string" select="substring-after($string, ',')"/> <xsl:with-param name="elemName" select="$elemName"/> <xsl:with-param name="elemNS" select="$elemNS"/> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:element name="{$elemName}" namespace="{$elemNS}"> <xsl:value-of select="$string"/> </xsl:element> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="node() | @*"> <xsl:copy> <xsl:apply-templates select="@*"/> <xsl:apply-templates/> </xsl:copy> </xsl:template> </xsl :s tylesheet>
In this XSL, change the YOUR_CSV_FIELD_NAME_HERE string near the top to be the name of the field in the database containing the CSV string (I think this would be checkedquestions in your case).
You should set both the from and to location XPaths for the Transform action to the same value, which points to the data block retrieved from the database, eg +?+?++/mve:eForm/mvc :D ata/my_table_name+?+?+?, and make sure that the Merge Option is set to Replace.
This transform will simply expand out the CSV strings, and create a single XML element for each selected value. In my testing the control seems to show the selected values correctly with this data structure even though the Data Format is set to CSV.
You shouldn+?+?+?t have needed to do any of this, but this will hopefully allow you to get the required behaviour until the underlying issue is resolved.
I hope this helps. Please let me know how you get on.
Regards,
Gerard
RE: Help with WM 4.0 Multi CheckBox Feature