Jump to content

Search the Community

Showing results for tags 'fieldtypeoptions'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 4 results

  1. Howdy all! In my process module I am creating a dynamic form which contains a variable number of checkboxes. The form displays correctly, and all but the selected checkboxes are saved. Tracy and the network show the array being passed in the post back to my process module. The target field was created as Select Options type, and the input is Checkboxes (Multiple values). I have tried the following without success: $p->of(false); $p->myOptionsField->removeAll(); // remove previous selected options foreach( $p->fields as $fld ) { // iterate page fields if( $fld->name == 'title' ) continue; // skip page title field if( $fld->name == 'myOptionsField' ) { bd( $input->post('myOptionsField') ); // Shows correct array of selected options $p->set( $fld->name, $input->post($fld->name) ); // No error produced //$p->myOptionsField = $input->post('myOptionsField'); // No error produced //$p->myOptionsField = $input->post($fld->name)->value; // Property of non object error } else { $p->set( $fld->name, $input->post($fld->name) ); // other fields are saved to database } } $p->save(); Note: I've also gotten an error about the sleepValue of the selectableOptionArray, but I don't remember what was wrong with the code to produce it. I left the tags in for this post to help others searching. Can someone please tell me how I should be doing this. I know it will be simple, as it always is, but my eyes are crossed.
  2. Hi all, Im trying to fill an options field in all the children of the parent page, after I save it. the options field is configured as multiple select checkboxes. here's the code i have so far: $this->addHookAfter('Pages::saved', function($event) { $page = $event->arguments[0]; //set the page if($page->template == 'sport-verenigingen-overzicht') { //get the subcategories from the parent textarea, split on newline $subcats = preg_split('/[\n\r]+/', $page->subcats); //(also tried without imploding and adding the array, also doesnt work) $subcats = implode("|",$subcats); //get the children $children = $page->children(); foreach ($children as $child) { //set the options(sport_categorie is the options field) $child->sport_categorie = $subcats; $child->save('sport_categorie'); } //if i use a normal textfield instead of an optionsfield, //all the children have the correct data e.g: test1|test2|test3 //how to get the values into the options field?? } }); Hope you guys can help! Keep up the good work, I'm loving what you're doing with PW!!
  3. I have a module that creates a bunch of fields and none of the Options type are saving their values. The options I have set appear in the page editor, however when I go to edit any of these fields the textarea where the options are supposed to be specified is blank. $f = new Field(); $f->set("name", "iu_do")->set("label","Action(s)"); $f->type = wire('modules')->get('FieldtypeOptions'); $f->set('inputfieldClass', 'InputfieldCheckboxes')->save(); $f->options = [0 => "Import", 1 => "Update"]; $f->set("required",1)->set("optionColumns",1); $f->set("tags","-impupd")->set("columnWidth",50)->save(); How do I do this right? Thank you.
  4. Hi everyone, I'm having a problem with a form I'm creating using the api. The form consist on multiple text fields, one file, and an Options field, everything works fine, except for the options field. The form creates fine, the main problem is on submit. I'm getting this error: Warning: Invalid argument supplied for foreach() in C:\Local\htdocs\wire\modules\Fieldtype\FieldtypeOptions\FieldtypeOptions.module on line 277 I already tried to check the type and use $post_value->id but it's not working. My code: if($input->post->submit_save) { // user submitted the form, process it and check for errors $form->processInput($input->post); $errors = array(); $required_fields = array(); $fields = array(); $post_value = $input->post->{$f->name}; switch ( $f->type ) { case 'text': $the_value = $sanitizer->text( $post_value ); break; case 'textarea': $the_value = $sanitizer->textarea( $post_value ); break; case 'checkbox': $the_value = isset( $post_value ) ? 1 : 0; break; default: $the_value = $post_value; break; } $fields[$f->name] = $the_value; foreach ( $fields as $key => $value ) { $page->$key = $value; } $page->of(false); $page->save(); } Any Ideas? Thanks
×
×
  • Create New...