Problems, need help? Have a tip or advice? Post it here.
4 posts Page 1 of 1
Hello again,

I'm working on an Application form and I had everything working pretty great but I wanted to change something.

Currently I am using a normal dropdown of the Open Positions pages using the dynamic option of a dropdown, like this:

Code: Select all
<!--cms : editable name='position' required='1' type='dropdown' opt_values="apply_open_positions.html" dynamic="opt_values" opt_selected="-" /-->


Now the guy doing the Applications has asked if it were possible to filter the Applications by Position and the folders came to mind.
So I would like to rewrite the current dropdown to a folder structure, but I can't get it to work.

Currently I have this:
Code: Select all
    <cms:pages masterpage="applications.php">
        <cms:if k_access_level le k_user_access_level>
            <cms:folder name="<cms:show k_page_name />" title="<cms:show k_page_title />" />
        </cms:if>
    </cms:pages>
    <cms:dropdownfolders masterpage='news.php' name="position" required="1" />


And in the Backend it works great, the Folders get listed fine, but in the front end the dropdown stays empty.
Code: Select all
<label>Which position are you applying for?
                        <select name="f_position" id="f_position" ></select>
                    </label>


I just can't figure out why :/
I already tried removing the access level check (since I don't know of if it would even work in the front end, but it could also be changed to a published/unpublished check), but it stays empty :(

I just can't figure it out. Is dropdownfolders just not bindable?

Also in case the check doesn't work, I assume I could dynamically assign the exclude the same way I did the original dropdown?

/edit
unrelated question. I've set the access control parameter of the template to 2 to test some things, but the form is still visible to logged out users, only the pages are locked, is this intended? How could the form be locked as well, if I wanted?
Even on 10 the form is still visible, I'm confused :D
I've found the answer to the Folder problem in a totally unrelated post (I was searching how to make a secure file downloadable ^^) here

TL;DR; is use the Folder Generator above, the dropdown works like this:
Code: Select all
<cms:input name="k_page_folder_id" type="bound" />


But can we make it not say "--Select Folder--" but something different (or blank)? And also make it required?

Of course I can do a
Code: Select all
document.getElementById("f_k_page_folder_id").options[0].text = "Please Choose";
document.getElementById("f_k_page_folder_id").options[0].value = "";
document.getElementById("f_k_page_folder_id").required = true;

but if there's a no-JS method it would be nice.
I am not sure I am understanding the full scope of what you are trying to do - the relevant form code would be helpful...

The part where you are creating folders from the pages of another template is nonstandard. I don't think this will work as you imagined, as only super admin users can make changes to templates - the listed folders won't always reflect the pages of the other template. I would suggest considering dynamic folders or page relationships. Perhaps if you state your requirements (in plain English, no code) we could make a suggestion.

If you want to change the dropdown markup, and specify validations such as required, I would suggest you don't use a bound input for the folder. Create your own dropdown cms:input with required='1' and then in your cms:db_persist_form, specify the input value for the k_page_folder_id parameter (example input is named my_folder):
Code: Select all
<cms:db_persist_form
    k_page_folder_id = frm_my_folder
/>
Ah well I think see the issue with my approach. The new folders won't be added when a regular user or admin visits the page, because folders are part of the template and templates can only be altered by super-admins, right?

So yeah I'll try to explain what I'm trying to do.
I'm currently working on an applications page and form. The open positions I did with a simple cloned page set up, and this is working great without issue, so I'm only working on the applications form right now.

The goal is basically that the people doing the applications can just create a new open position, and it will then show up as a position in the dropdown of the apply form. At the same time the applications shoould be able to be filtered in the backend, so I thought I could use a folder for them, since there is already a filter field the backend when folders are enabled. Since I only want to filter by position this would be all I need.

So my idea was basically to generate folders from the positions and have them shown in a dropdown box to be selected by the applicant.

The idea was also that the editors should be able to deactivate a certain position (but let it sit in the backend for later use) and it will automatically be gone from the open positions, as well as the dropdown of the apply form. I already managed this in the open positions listing, and it worked for me in the apply form as well, though this is probably because I was super admin all the time.


So yeah, you mentioned Dynamic Folders, but as I see it the editor would need to add the folders manually each time they create a new position, and also would need to delete the folder one a position has been deactivated. The problem with this being that all pages in that dynamic folder would loose their folder, right? Of course I could the folder manually, but use a page listing in the apply form. But then the names for the folder would need to be 100% that of the open position, right? I would like them both to be coupled together so that an open position only needs to be added and/or deactivated once, is this even possible?

Would a new folder be automatically created when it is first used?
So assuming I would go with a custom dropdown field (with a listing of the open positions as before), then specify the form input as folder name, would (non-existent) folder be created automatically? Or does the Dynamic Folder need to be created in the backend before that? If it was created automatically this would probably solve all my problems :D

I hope it was understandable what I'm trying to do and sorry for the wall of text ;)

/edit
So I just tried assigning a nonexistent folder (basically a k_page_name to k_page_folder_id), and the folder did not get created :/ Would have been too easy I guess :D

/edit2
I also just tried a Many-to-One relationship (since there are multiple Applications to one Position, right?), but I couldn't find a way to filter all applications by the position they apply to. I could of course display them under the position in the front-end (with an user access level check), but I kinda want them on one overview page :S
4 posts Page 1 of 1