bwakad Posted March 29, 2014 Share Posted March 29, 2014 I am having a hard time find information about setting a default value in the backend at a select for pages. I tried : page=ID fieldname=ID I have looked in the API and all, but could not find specifics on Default Value Link to comment Share on other sites More sharing options...
cstevensjr Posted March 29, 2014 Share Posted March 29, 2014 http://bit.ly/1iMfAIJ Link to comment Share on other sites More sharing options...
bwakad Posted March 29, 2014 Author Share Posted March 29, 2014 Okay, so - how to I solve this? The first select (province): regular selectable pages: parent page = location accepts: page=ID as default value The second select municipal: custom selectable pages: parent = page.province accepts no default value As a result, the first select has a value by default, but to populate the second one, I first need to switch to another choice. Or I leave the first on blank by default, but still the second one is not populated and therefore very small. This issue (see image) causing the second select to be very small to start with. And I do not know how to make the selectbox more width, or invinsible until a choice is present in the first. Link to comment Share on other sites More sharing options...
cstevensjr Posted March 29, 2014 Share Posted March 29, 2014 If you are talking about the "municipal" field, my first question would be do you have any pages assigned to that field? Link to comment Share on other sites More sharing options...
cstevensjr Posted March 29, 2014 Share Posted March 29, 2014 Let me be a bit clearer - I believe this to be correct: If you assigned that field to a page and haven't added any pages to it, the field will look like it does in your image. Once you add pages, it will be as wide as whatever the title is of the longest named page. Link to comment Share on other sites More sharing options...
bwakad Posted March 29, 2014 Author Share Posted March 29, 2014 see attached image... root - location - - province1 - - - municipal1 - - - municipal2 - - province2 - - - municipal3 - - - municipal4 etc. the field province has parent page location the field municipal has a custom selector parent=page.province Link to comment Share on other sites More sharing options...
cstevensjr Posted March 29, 2014 Share Posted March 29, 2014 From your image, Drenthe is the first entry and it shows up as the default. If you want another location to be the default, move it to the top where Drenthe currently is. If there is something else you are trying to do, you have not adequately explained what it is that you want. It would be advantageous to you if you described exactly what you want and what you expect the result to be. "See attached image......" is not helping anyone help you. You have another topic https://processwire.com/talk/topic/5962-page-id-is-not-valid-for-field-name/ which, to me, seems related. A simple google search turned that one up and others. Link to comment Share on other sites More sharing options...
bwakad Posted March 29, 2014 Author Share Posted March 29, 2014 Actually it was in response to your question asking me if I had any pages for this second field, but of course then nobody see what's inside. My mistake. The first select I described, has no problems. If I simply leave the default value out, it will display as the 2nd image attached. I just can't get the second select to start width (with at least a value or blank). Link to comment Share on other sites More sharing options...
bwakad Posted March 30, 2014 Author Share Posted March 30, 2014 Although a default value for 1 single select works, it does not work on dynamic single selects. The only way I could solve this was to take out the default value for the first select. Then on the second select I used: Show this field only if province!='' On a new page where fields where not chosen, and on edit page where fields where added after creating the page: First field (province) shows blank and full width. And when choosing a value; second field (municipal) shows blank and full width. And in template files I don't have to worry about default value because fields are required before saving. Note! would be nice if developers just remove the default value at back-end to avoid confusion! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now