Adam Kiss Posted March 6, 2013 Posted March 6, 2013 Hello, just a quick question: Is it possible to create inputfield without any db data? I'd like to create a field, that would take place in administration, but wouldn't actually have any data; it would just include some Javascript and show shortcuts to run it (read: I need multiple 'default' values and easy way to switch between them) Hope it makes sense, Adam
Adam Kiss Posted March 6, 2013 Author Posted March 6, 2013 Antti, how would I do it? I need to base it on some fieldtype, don't I?
apeisa Posted March 6, 2013 Posted March 6, 2013 Well, you technically only need inputfield, since that is responsible on what is shown on admin. But it would feel wrong to use textfield or any other data containing field, so I would probably create corresponding dummy fieldtype also.
Martijn Geerts Posted March 7, 2013 Posted March 7, 2013 Think Fieldtype Concat will help you out. Only fieldtypes stores data in DB, not their fields. So I think when you look at The above Fieldtype lots of questions will be solved. 2
Adam Kiss Posted March 7, 2013 Author Posted March 7, 2013 Well, thank you both! I solved it a different way, afterall, but this will sure come in handy in the future.
pwired Posted March 7, 2013 Posted March 7, 2013 This is an interesting topic. Using fields in the administration without db data but holding custom js or css that you can call in your webpages. Apeisa: how do you create an input field with a dummy field type Adamkiss: how did you solve it ?
apeisa Posted March 7, 2013 Posted March 7, 2013 Pwired:take a look concat field above. Similar, but even without the concentrate string returned.
Adam Kiss Posted March 7, 2013 Author Posted March 7, 2013 I just created JSModule (or ModuleJS), which includes custom JS into the page load, and my Javascript modified the DOM, inserted the correct buttons and set callback for them. It would be somewhat more elegant, if I had the buttons that do stuff already included as a field, but this works as well, although the hooking code (I am inserting some shortcuts into each item of repeater field) is somewhat ugly.
pwired Posted March 7, 2013 Posted March 7, 2013 Thanks for your replies, this is one of the open parts of PW where I still have to learn how to use it.
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