Jump to content

Martijn Geerts

PW-Moderators
  • Posts

    2,769
  • Joined

  • Last visited

  • Days Won

    31

Everything posted by Martijn Geerts

  1. value === 1 only works if the value is an 1 integer, which is not when submitted via a form post/get. ( value coming from object, InputfieldJson ) So what does $this->fname contain? $this->message(gettype($this->field_numeric) . " - value: " . $this->field_numeric); // message: InputfieldJson: integer - value: 1 Somehow it doesn't work in the context of ___getConfigInputfields(). It does however work in the context of getModuleConfigInputfields I'll settle with the InputfieldRadios... still unsolved. ProcessWire 2.4.1
  2. Exactly Adrian. If i var_dump it it tells me int. there people over here so, if they leave, will do more tests
  3. Unchecked checkbox have no value I think.
  4. For what I remember from source (on mobile here) is that any value evaluate to true, is converted to 1 for the checkbox. So you code looks like that if it has markup, render the checkbox... Gonna check this out when I'm able to get back to the computer tonight.
  5. if( $this->fname ) $field->attr( 'checked', 'checked' ); Same outcome, doesn't work. :-(
  6. It's not possible to not use PHP.
  7. start edit: if someone else experience issues with checkboxes, here's the code that solves it for me end Am I doing something stupid, or is it broken? Because code below won't function. $field = $this->modules->get('InputfieldCheckbox'); $field->attr('name', 'fname'); $field->attr('value', 1); $field->attr('checked', ($this->fname === 1 ? 'checked' : '')); // $this->fname is an int I'm using this in ___getConfigInputfields. For other types of fields it works: $field = $this->modules->get('InputfieldRadios'); $field->attr('name', 'fname'); $field->addOption(1, __('Yep')); $field->addOption(0, __('Nope')); $field->attr('value', $this->fname);
  8. $fields->get("myfield"); // (object) derived from Field object, $page->template->fields->myfield; (object) derived from Field object, $page->get("myfield"); // (string) value entered in the backed for that page $page->myfield; // (string) value entered in the backed for that page
  9. And sometimes it's easier if you only want to know the type: echo gettype($variable); Manfred has right, you should read those docs from word 1 till the end
  10. Yummi Yummi, lookin' nice !
  11. $fields->get("name") returns a Field object with the name "name". The name set to the field in the backed creates a table in the database with field_ prepended to it. Fields->get($name) is the lowest level of getting the field. (Read, not in template context.) $page->template->fields->name, here you get the field in context of the page, and thus in context of the template, easier is it to get the field from the Page object directly: $page->get("field") or $page->name-of-the-field. Every field can has his own label, description size settings etc etc. depending on the context where it is used. So this is why the title field could have a label Title, and in an other template the label Product Name. Label, description and other stuff is inherited from the field without the context, you could override it in the template context. $fields->get("selector"); // get a field object, rare to need this on template level and easy websites. (string) $field; // it's a variable with the type of string, type casted to be sure it is a string. $field->get($key); // get a object property methode etc. of the field rare to need this on template level and easy websites. $field->set($key, $value); Setting values to the field object, these must be of the same type of the object you're setting the values. Rare you need this one to.
  12. Here's the homework
  13. Sometimes students need homework, thats belongs to the lessons to.
  14. How is the setlocale setup ? Maybe today is set to american and the italian doesn't like the order of the time. (United states MDY, most European DMY)
  15. @bwaked: Why are you guessing that $cck would be $page ? Go ahead, and go try for your self. ( This way you won't let other people work, and the result is: You learn a lot more. )
  16. if $director user is not found, $director will be a null user. If you ask his ID, the id will be 0 (read zero) 0 is equal to false.
  17. This is a good example for creating a new Textformatter or extend the existing one. Textformatters are relatively simple to create. Why not try it your self, you have the community here to help if you run into problems.
  18. Making a first post, and the only message is to recommend a product. The message and link benefits the organisation and has no additional value for ProcessWire. I think this is inappropriate I consider this as spam. Welcome to ProcessWire !
  19. He's obviously to quick with conclusions.
  20. Thanks send out the words. I loved to watch the whole show. The presentation was good to follow.
  21. Now I can't save data from the API side to the field. I moved all data around put most logic in sanitizeValue(). On the admin side, the processInput() is handling the trackChange, so sanitizeValue knows how to kick in. Now if I try to populate data from the API side, trackChanges are never fired, and I don't know where to fire those. Who can give me a clue ? ( I did studied the FieldtypeMapMarker, eventfield fieldtypePhone ) source on github //------- trackChange is fired, but while saving with the API the InputField is ignored. In my case the Inputfield sets some variables. So when I save through the API, some variables are not set, and thus I know the API is saving, not the InputField.
  22. Have you assigned the formatter to the field ? Admin/Setup/Fields/Edit/Field: name-of-the-field --> Details: TextFormatters
  23. I'm sorry bwaked, I do see you post a lot of questions here on the forum. Nothing wrong with questions, but a lot of questions you wouldn't asked if you read and understand the docs. Do yourself a favour, start reading the docs. Those are well crafted & fun to read.
  24. What text formatters you've assigned to the field you're outputting?
×
×
  • Create New...