Stefanowitsch Posted September 17, 2021 Share Posted September 17, 2021 This question is maybe trivial but I found no solution. When generating a form with the processwire API I want to make use of some hidden fields. When generating these fields the corresponding label is always shown in the frontend. Which in my opinion makes no sense (it's a hidden field, though!). This is the code I am using. $field = $modules->get("InputfieldHidden"); $field->attr('name','Name'); $form->append($field); On my form page in the frontend I then see a label called "Name" but no input (which is fine). The only solution that comes to my mind is to hide the label of the hidden field via CSS but that is not a clean solution. Link to comment Share on other sites More sharing options...
fliwire Posted September 17, 2021 Share Posted September 17, 2021 Link to comment Share on other sites More sharing options...
Robin S Posted September 17, 2021 Share Posted September 17, 2021 $field = $modules->get("InputfieldHidden"); $field->attr('name','Name'); $field->skipLabel = Inputfield::skipLabelMarkup; $form->append($field); https://processwire.com/api/ref/inputfield/#pwapi-methods-skipLabel-constants 3 Link to comment Share on other sites More sharing options...
Stefanowitsch Posted September 18, 2021 Author Share Posted September 18, 2021 Wow that does the trick. Thanks a lot. The skip label markup syntax looks a bit weird at first but now I see that it is a mighty tool. I assumed that you just could write skipLabel = true. So the markup returns a number that the code is then working with. This does the same: $field->skipLabel = 8; 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