This project is read-only.

Custom forms submissions naming

Topics: Administration, Core, Customizing Orchard, General, Localization, Troubleshooting, Writing modules, Writing themes
Dec 14, 2012 at 11:16 AM

I have my custom form named "Contact Us" (for example). This form is using content type named Contact Form. When I submit my form on front-end and then try to see my submitted forms on back-end I can see all my forms submitted with name "Contact Form". May I set submitted form name as I want? For example if form has fields "First name" and "Surname",  I would like my forms submissions have names "First name Surname".

Is it possible?

Dec 14, 2012 at 7:55 PM

Yes, one could build a module that creates token-based display text for arbitrary content types actually. Something like a dynamic title part.

Dec 15, 2012 at 12:05 PM

Like tokenized title? :-)

Dec 16, 2012 at 7:16 AM

Yay Zoltan!

Dec 17, 2012 at 7:49 AM

Ok. But how is it to be used? Could you give an example please?

Dec 17, 2012 at 6:39 PM

Same as slugs:

Dec 17, 2012 at 10:04 PM

@Sergey: have you read the documentation?

Dec 18, 2012 at 7:05 AM

@piedone I have the same pb as Sergey and I have read the doc (thanks for the RTFM :) ), and also read your code, and tried it

Problem is that my Custom Type (processed by the Form) has no Title Part and no Autoroute.
If I add your Title Part, the user of the custom form must input it, and this is not what I am looking for.

I only want to have the submissions named with something as custom_prefix_Name_Firstname, rather than a number.

And I don't understand how to do this without writing some code, which was not my intention.

Is the idea to suppress the part title from display using a placement file ? But how to install automatically the values in Title ?

Could you help ?

Dec 18, 2012 at 9:05 PM

Sorry, didn't mean it in an RTFM-y way :-). You're right, you'd need two things:

  1. Hide the editor shape from
  2. Have a default value specified for it so it gets automatically filled (probably the most simple way would be to just fill it from the ctor of the part'd record).

This both need some coding and indeed the result won't be perfect but currently that's the easiest way. If you want to go on you could create a new token title part that can be configured from part settings for all the items of a content type or enhance the current module to have settings for a default (like AutoroutePart has settings for default that can be overridden).

Dec 18, 2012 at 9:40 PM

Thank you :), things are clear now.