I'm creating a form for a user to fill out, i want to list the offices in a checkbox list to allow the use to select an office from the list. I know i can create the checkbox list datatype with pre defined values but the cleaver way would be to list the offices based on the thier document type from the main site.
That way if the client add another office to the site or rename the office my checkbo list will auto update.
thats ideal Dirk, i'll maybe try the razor version as I've been meaning to get into this...this leads me to another question...
I've created a member type which contains additional info on the staff member and I've created a new property for office/location, how would i get the new checbox list t appear in my type dropdown or should i go about this in a different way?
If you want a checkbox / dropdown list in the Umbraco back office (to be populated with content nodes), the uCompoents XPathCheckBoxList or XPathDropDownList could be useful.
- for each member, the selected values from the checkbox list are stored in db in table cmsPropertyType (not sure whether it' stored as a comma separated string or as an xml fragment). Also be aware that values stored in db may be different than values stored in xml cache (id's vs values)
- the possible values for the checkbox list (there's some static functions in the umbraco.library class that would return a list of possible values...)
Hope this helps you getting started. But as mentioned on other post, try to find out whether those packages may be a good fit for your case.
checkbox content from site content?
I'm creating a form for a user to fill out, i want to list the offices in a checkbox list to allow the use to select an office from the list. I know i can create the checkbox list datatype with pre defined values but the cleaver way would be to list the offices based on the thier document type from the main site.
That way if the client add another office to the site or rename the office my checkbo list will auto update.
Is there a way to do this?
S
Stephen,
Are you trying to do this from xslt? Or Razor? Some starting code snippets:
@foreach (var node in @Model.NodeById(-1).Descendants("aliasOfDocumentType")) {<input type="checkbox" name="" id="" value="@node.Name"><xsl:value-of select="@node.Name" /></input>
}
Hope this helps.
Regards,
/Dirk
thats ideal Dirk, i'll maybe try the razor version as I've been meaning to get into this...this leads me to another question...
I've created a member type which contains additional info on the staff member and I've created a new property for office/location, how would i get the new checbox list t appear in my type dropdown or should i go about this in a different way?
S
Hi Stephen,
If you want a checkbox / dropdown list in the Umbraco back office (to be populated with content nodes), the uCompoents XPathCheckBoxList or XPathDropDownList could be useful.
HTH,
Hendy
there's two things to be aware of
- for each member, the selected values from the checkbox list are stored in db in table cmsPropertyType (not sure whether it' stored as a comma separated string or as an xml fragment). Also be aware that values stored in db may be different than values stored in xml cache (id's vs values)
- the possible values for the checkbox list (there's some static functions in the umbraco.library class that would return a list of possible values...)
Hope this helps you getting started. But as mentioned on other post, try to find out whether those packages may be a good fit for your case.
Cheers,
/Dirk
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.