Jump to content


Photo

New page from inputfield

solved page fieldtype inputfield

  • Please log in to reply
16 replies to this topic

#1 statestreet

statestreet

    Jr. Member

  • Members
  • PipPip
  • 43 posts
  • 11

Posted 23 February 2012 - 02:27 PM

Often, the pages I find myself referencing in a page field (whether through asmSelect or otherwise) are very simple. They might be categories, tags, or something along those lines, but they only contain a single text field. In cases like these, it would be great to be able to add new ones from the page that contains the referencing field.

So if, for instance, I were adding a new page to a site, and had a "topics" field that selected pages from /topics/, and I realized that topic didn't exist yet, I could add it from the page without having to go back to the page tree, navigate to /topics/, create a new topics page, publish, then return to my unpublished new content page.

I suppose the most straightforward plan of attack would be to create a new inputfield module, but ideally, this could be applied to any of the existing ones, whether checkboxes, asmSelect, or auto complete. Can a module extend other modules in that way?

#2 ryan

ryan

    Hero Member

  • Administrators
  • 5,773 posts
  • 3115

  • LocationAtlanta, GA

Posted 23 February 2012 - 04:51 PM

I agree, it would be very handy and I've been wishing for this on many occasions too. Most likely we'd just add it to InputfieldPage, which is the container Inputfield for all Page selection inputs. I will put some more thought to this to see how we might implement it.

#3 slkwrm

slkwrm

    Sr. Member

  • Members
  • PipPipPipPip
  • 248 posts
  • 66

Posted 23 February 2012 - 05:01 PM

We had similar thoughts about it a couple of days ago here

The only thing that's missing to make workflow really handy is, as Pascal said, a possibility to create new pages (building blocks) instead of just being able to select them.



#4 statestreet

statestreet

    Jr. Member

  • Members
  • PipPip
  • 43 posts
  • 11

Posted 23 February 2012 - 06:29 PM

I wonder, could this use something akin to the fieldset-in-a-fieldset approach that repeaters now use? Perhaps it could even just replicate all the fields from the referenced template inside inside a fieldset in the page field, so while it might be best-suited to creating new pages with only one or two fields in their templates, it could expand to any template a page happened to use.

#5 Pete

Pete

    Administrator

  • Administrators
  • 1,756 posts
  • 658

  • LocationChester, England

Posted 24 February 2012 - 03:50 AM

I think that even for slightly more complex pages it could be useful to throw up a modal window that goes through the process of adding that page as you would normally.

I've got a few fields on one project where it's more than just a title, so whilst I would like to see a simple option for fields that are just linking to a page with a title I think that being able to add a more complex page would be hugely beneficial.

What I wouldn't want to do is have the ability for someone to add a new page title and then forget to fill out the rest of the page after saving the current page, but I think that displaying a large page inline like with the repeater fields could get messy - especially since you need to take into account that page's tabs too.

That's the only reason I was thinking of a modal window for it :)

#6 statestreet

statestreet

    Jr. Member

  • Members
  • PipPip
  • 43 posts
  • 11

Posted 24 February 2012 - 12:31 PM

I don't know, modal windows sound messy too, but maybe that's just because I've been scarred by WordPress's cumbersome image insert boxes. :)

Any way you go about it, you're probably looking at a somewhat less-than-ideal situation if you're adding a page with lots of fields while editing another page that references it. If it has enough fields that a user might forget to fill some of them out, it's probably worth going the long way around instead of trying to add it in-context.

#7 ryan

ryan

    Hero Member

  • Administrators
  • 5,773 posts
  • 3115

  • LocationAtlanta, GA

Posted 24 February 2012 - 02:31 PM

I have this setup and working, so should be able to commit it to the source here within the next few days. While I think there are a lot of good ideas here with regard to how to go about it (and possible future directions), I'm taking the quick+simple route for now. This will solve the majority of adding-page-reference needs for me at least. So the way this is setup, you could paste in a few hundred pages to add if you wanted to. Also, this works with all the page reference inputfields (checkboxes, selects, asmSelect, radios, autocomplete, PageListSelects, etc.) This was easy to do, because InputfieldPage is already serving as a container Inputfield for all the others, so it was just a matter of having that module append to the output of the selected inputfield module. Check out this brief demo:



In order to use it, you check the box on your page reference 'input' tab settings, like shown in the video. Your page reference field has to have both a parent and template defined with it. It also has to use the 'title' as the label field (which 99% of the time I'm sure we already do). If the user doesn't have access to create new pages in the parent or with the template, then the option to add new pages won't appear.

If used with an inputfield that only allows selection of a single page (rather than multiple pages) then it gives you an <input type='text'> rather than a <textarea>, since you can only add/select one page in that scenario.

#8 adamkiss

adamkiss

    Master of the universe

  • Moderators
  • 1,078 posts
  • 289

Posted 29 February 2012 - 11:55 AM

So, this is done, and will be soon merged to master, correct? Marking as 'solved' :)

#9 Soma

Soma

    Hero Member

  • Moderators
  • 3,188 posts
  • 1745

  • LocationSH, Switzerland

Posted 01 March 2012 - 05:54 PM

I'm just thinking wouldn't it better to be able to really create the page in a modal dialog of a template specified? I'm thinking because if I often need to create multi-language page and in case of categories I use multiple title fields one for each language. This way with new lines is suited well for things like names that would be neutral.

@somartist | modules created | support me, flattr my work flattr.com


#10 SiNNuT

SiNNuT

    Sr. Member

  • Members
  • PipPipPipPip
  • 366 posts
  • 231

Posted 01 March 2012 - 07:36 PM

I really like this functionality and in a lot of situations the implementation based solely on titles will suffice and additionally has the benefit of being able to add/paste in multiple items at a time.

But at the same time i gotta agree with Soma: quite often the page(template) you want to reference has more than one field you will want to populate. From a UI- and fast workflow perspective it would be great if this was possible. I guess this would mean some sort of modal popup. As the PW user-base expands i think this would be frequently used and a killer feature, really taking the relational aspect a step further (from UI perspective).

So for possible future directions, and to make PW even more awesome than it already is i ask you to take this into consideration.

#11 ryan

ryan

    Hero Member

  • Administrators
  • 5,773 posts
  • 3115

  • LocationAtlanta, GA

Posted 02 March 2012 - 07:21 PM

I totally agree it would be great to have a modal dialog that then creates pages and all their fields. But there is a rather large difference in development time between that and what I've added. I added what I could afford to in the short term. Down the road, I'm sure we'll expand the capability to take the modal route when dealing with creating pages that have more than just a title field. But since I could add the title-only page additions in the short term, I figured that's a good place to start. Even when we expand with the modal dialog, I do want to keep the current method for when the template has just a title field. The reason is that this is a very convenient way to create large selects. Lets say you need a "country" select -- you can paste all 196 countries into that field and create all your select options in one shot.

#12 apeisa

apeisa

    Hero Member

  • Moderators
  • 2,525 posts
  • 851

  • LocationVihti, Finland

Posted 03 March 2012 - 02:21 AM

Yes, even this will be very handy in many occasions. Tags, categories, select values.. even more complicated stuff, where you are ok with just title added are fine.

#13 ryan

ryan

    Hero Member

  • Administrators
  • 5,773 posts
  • 3115

  • LocationAtlanta, GA

Posted 03 March 2012 - 11:34 AM

This feature is now available in the latest commit. Please let me know how it works for you guys. You will see a new checkbox option available with page reference fields when editing them under: Setup > Fields > Edit: [your-field] > Input [tab] > "Allow new pages to be created from field?". It includes instructions on the required settings for it to be active.

#14 diogo

diogo

    Hero Member

  • Moderators
  • 1,996 posts
  • 1073

  • LocationPorto, Portugal

Posted 03 March 2012 - 12:03 PM

Just tried it, it works well. easy and simple!

#15 neildaemond

neildaemond

    Sr. Member

  • Members
  • PipPipPipPip
  • 111 posts
  • 31

  • LocationHong Kong

Posted 24 July 2012 - 09:07 AM

I use this feature to makes tags on my site. However, now that I have more tags, these checkboxes are listed in chronological order and become hard to find. It would be nice if they were in alphabetical, or if I were able to choose how they were sorted.

maybe PW 2.3 could add a feature to sort all child pages when listed in the admin (when there are many it becomes hard to move them all around one by one).

#16 ryan

ryan

    Hero Member

  • Administrators
  • 5,773 posts
  • 3115

  • LocationAtlanta, GA

Posted 25 July 2012 - 10:32 AM

I'm not 100% sure I understand the question, so let me know if I'm answering the wrong thing.

The behavior here depends on how you've defined your selectable pages, as well as what inputfield you've selected. The PageList inputfields will sort in the same way your page tree does. Whereas the others will sort according to the selectable pages definition. If you chose a parent for the selectable pages, then they should sort according to the parent's sort setting (on it's children menu). If you are using some other criteria to find selectable pages (like template, by itself), you may want to instead use the "custom selector to find selectable pages", and specify the "sort=field" right there, i.e.

template=something, sort=title

When you add a page to a multi-page selection, where it goes in that selection depends on what inputfield you are using. If using asmSelect, PageAutocomplete, or PageListSelectMultiple, new selections are appended to your list and you can drag-n-drop them wherever you want them to be. If using checkboxes or regular select multiple, then the selection should stay consistent with the source.

#17 neildaemond

neildaemond

    Sr. Member

  • Members
  • PipPipPipPip
  • 111 posts
  • 31

  • LocationHong Kong

Posted 25 July 2012 - 12:15 PM

ok, I'm so sorry for wasting your time... it is a really simple setting.

my new pages made by inputfield were put under the parent 'tags'.. so in the admin tree, I just needed to click tags > edit > children... then there is a sort setting there.

I never knew that setting existed, another win for PW usability.

Thanks Ryan~!





Also tagged with one or more of these keywords: solved, page fieldtype, inputfield

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users