Jump to content

[SOLVED] FormTemplateProcessor : how to get title in the front end?

Recommended Posts


I'm using FormTemplateProcessor module to dynamically create pages and save data.

But for some reason, it's not showing title field in the form that's being rendered on the front-end.

Also when the page is being created, right now, it's auto-generating some name, I'd like it to have title.

I want to know how to

  1. Get title in the front-end form & save it along with the rest of the data.
  2. Save page with its name rather than auto-generated name.

Thanks in advance.

Link to post
Share on other sites

I haven't used that module, but it looks like it is focused on processing a contact form. So the name of the page is being autogenerated as a datetime stamp ($this->contact->name = date('y-m-d-H-i-s-u');) so it is unique to each user's contact submission - the title is not really relevant for this purpose as I see it. 

If you want to save user generated content as a page, I would recommend this as a starting point:


You can use the title that the user enters and use it for the page's name.

Hope that helps.

  • Like 1
Link to post
Share on other sites

Thanks adrian for your reply.

I checked the link but since I'm not a great programmer, I find it bit hard to use. :P

So, I went on checking the FormTemplateProcessor module and changed the line 192.

I replaced datetime stamp with the field title.

So it works for me :D

I don't know how proper is this but it kinda gets my work done.

I'd like to hear from experts if this is the right way.

Thank you all.

Link to post
Share on other sites

A couple of things to consider. Take a look at the sanitizer options for page names:


One concern with using the title for the page name is name uniqueness. Take a look at this thread for more details/options:


  • Like 1
Link to post
Share on other sites

Remember to sanitize you title:

$sanitizedTitle = $sanitizer->pageName($this->contact->title)
$this->contact->name =  $sanitizer->pageName($this->contact->title);

@Ardian: yes, totally right, it's necessary to check if the page with this name already exists or eliminate errors by adding a numerical suffix.

Link to post
Share on other sites

@slkwrm & @adrian,

thank you, yes I'll make sure sanitize the input.

@adrian, about the duplicate names, actually, I wish to store username as the name of the page created. Username should be unique. Also there should be a way to check if the username is taken. Can we do this in anyway?

Link to post
Share on other sites

Does the person creating the page need to have an existing username? That would avoid the need to check.

If not, less us know - there are options, but don't want to go too far down that road if you will be using the username of an already logged in user.

Link to post
Share on other sites

Ok, I saw some other posts from you about this. Did you end up using some of the code from this post:


Depending on your needs, you could add additional fields to the user template, rather than needing a separate page.

Regardless, when the form is submitted you need to check for the existence of the username. If it already exists, return the error and get them to enter a different name. If it doesn't exist, save the user and if you need, add the new page using their new username for the page name. Probably stating the obvious here though.

I assume you already have the front-end user registration form working? It sounds to me like you might be better served by extending that to add the page, rather than using the FormTemplateProcessor module. Maybe if you post the code you currently have it might make it easier to add the required functionality.

  • Like 1
Link to post
Share on other sites

Short answer: No, I didn't.

Long answer: I checked that post numerous times but I'm lazy, I always look for simple solutions just because I'm a front-end designer guy, not a hardcore programmer so I just used FrontUserProfiles module by Khan and it seemed to work good. But now, I've a problem that I need to store users' purchase history and few other user specific details.

So Yes, I already have the registration & log in system working.

I don't know if I can add additional fields to user template, if I can, then that'd be great. I think the better thing to do now would be finding a way add additional fields to user template.

I'd love to share the code with you but I've no idea exactly which part of code I need to share.

And thank you, I really appreciate your time & help. :)

Link to post
Share on other sites

You can have your user's page name the same as the user name. Not unique names can cause problems only when we talk about the pages belonging to the same parent.

You can always check if the page name is unique using something like:

if (!$pages->find("parent=$myParent, name=$myPageName, include=all")->count()) {

 //the page with this name doesn't yet exist within specified parent so it's safe to add myPage under myParent...


Yes, you can extend user template with additional fields. Just go to templates and choose to show system templates in the filter option.

  • Like 2
Link to post
Share on other sites

I had forgotten about that module. If you want to go the route of adding new fields to the user template, that is easy. Just go to templates and click on filters and show system templates. Then you can add any new fields you want to the user template. 

@slkwrm - your edit stole my thunder :)

  • Like 2
Link to post
Share on other sites

Oh wow, that's nice.

I didn't know we could edit system templates this way, lovely!

So I guess no need to add page for every user.

But still I'd like to ask both of you if you think using the FrontendUserProfiles module is a good idea to manage users and use this module for production level?

Since I'm no expert, I'd like to know your view on this.

Again, very grateful to both of you. :)

Link to post
Share on other sites

A posibility I also use is have a page field reference added to the user template and reference the userpage there. Makes it easy to setup and you dont have to care about names as it's already checking for unique username.

  • Like 2
Link to post
Share on other sites

I have never used it, but I don't see why not - it has been listed as stable and if it's doing what you want you should be fine. Soma will have a better idea though :)

Link to post
Share on other sites

Yes exactly. The pseudo user page can be anywhere and you could add children pages for all kind of things. And only a couple field like prename lastname to the real user template. You dont have to it's up to you. I also think you're creative enough to already see what is possible it's more the code you worry. Let me say in PW it'S REALLY no rocket sience compared to other systems and just keep trying to go with the simple API. Once you learned that you'll do anything with ease. :-) Maybe I'm too modest but I'm also not a hardcore programmer but a design guy, and learned a whole lot with PW. Of course I got some background and did a lot with php. You're in good hands with the guys here.

  • Like 4
Link to post
Share on other sites

Such kind & sweet words!

I can't thank enough to you guys, not only do you help people like me to do something that we can only dream but also support & understand us.

This very thing, the flexibility that PW provides is what allows me to make websites which I could never even think of before.

It's easy to learn & work with PW provided you know what to look for & where. I've just basic knowledge of php which also I learnt just to work with ProcessWire, cause I had understood the potential of PW a while ago but I really started using just a few months back.

So the topic is solved, I'll continue with FrontendUserProfiles module & add pages for users to store additional information.

Thank you all once again. PW & this forum rocks!!!

  • Like 2
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By louisstephens
      So I ran into a strange error this morning when trying to publish a page. I went to publish a new page under "clients", but I get an error that says "Cannot be published until errors are corrected". I thought perhaps I had missed a required field so I checked, but none of the fields are marked as required. I then checked to see if I could just add a basic page (default basic-page.php template) under the homepage, but I get the exact same error when trying to publish. When looking at the template, I don't see any error messages being displayed above any fields.
      The odd thing I found though was if I got to "settings"  and uncheck "unpublished", I can then publish the page without errors. I did upgrade earlier today to the newest version to hopefully fix an issue I had yesterday (which it did). Has anyone run into this error before? 
      Well, after a lot of staring and pulling my hair out, I found the issues. I had installed multi-language support sometime ago (and due to the project changing, had to remove it). Apparently in my haste, I did not remove all the dependencies so it was still trying to check for the multi-language title (I am guessing) even though it actually wasnt on the page. I went through the database and removed it and can now save/publish pages without issues. 
    • By NehaPillai
      Hello Everyone, I was trying to update SEO meta title, description and meta keywords for my website in Process Wire CMS but it saving in the backend but it is not reflecting on my website, Please help me regarding this error. Please find below attached screen shot for your ref. TIA.

    • By AndZyk
      when you add a page you can see the page name of the page under the page title field. But when you change the page title afterwards, you have to go to the settings tab to also change the page name.
      We have many clients that change the page title afterwards but forget to change the page name, because they don't look in the settings tab or forget it.
      Is it possible to show the page name on the content tab under the page title?
      I hate to say this, but I like how WordPress handles this better:

      Or should I open an GitHub request?
      Regards, Andreas
    • By j00st
      Hi all! 
      I've been searching/browsing a bit, but can't find what I'm looking for just yet...
      Perhaps I'm searching in the wrong places, but I thought posting it here might work better/more efficient.
      I need to do the following;
      1. I have the TITLE field (the one set by ProcessWire as default).
      2. There's already a whole lot of pages of the template 'project' set up.
      3. Now I actually want to be able to add <i> and <br> tags to this title...which is possible if I turn off the specialchar encoder...
      ...but it also presents the opportunity for people to start typing, and generate the following kind of URLs:

      TITLE: This is a really long title <br> which <i>needs</i> to be split in two
      URL generated: this-is-a-really-long-title-br-which-i-needs-i-to-be-split-in-tow
      Don't want that happening. So, I thought it might be wiser to do the following.
      Next to the 'title' field, also set a 'display-title' field.
      But, preferably I'd want to generate this for all the projects already in existance...including copying their content to this new display-title field.
      Just adding the field means all the titles will need to be copied...not something I look forward to telling the editors of the site 🙂
      I saw the Hook for on-save, but that's only for the single page...and I'm not an experienced MySQL-coder/user, otherwise I guess that would've been the way to go.
      So I'm really curious to hear if you guys think there are other/better options (and what they are)
    • By Roberts R
      Can someone point me to the way how to fix title to name? so "ā" becomes "a" and so on. see attachment

  • Create New...