Jump to content

sms

Members
  • Posts

    25
  • Joined

  • Last visited

Profile Information

  • Location
    Hamburg, Germany

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

sms's Achievements

Jr. Member

Jr. Member (3/6)

4

Reputation

  1. Wow, thanks a lot, this looks much better than my attempt. And it works fine ? Actually, I was also planning to work with IDs, but I just didn't get to the point how to combine the two arrays in one loop. Thanks for the additional explanations. I didn't know getPageByID is available since 3.0.162. Thanks again, you saved my evening ?
  2. Thank you, Jan! Putting $id in quotes works ? Here is the form with which I want to change a stock (should become a small stock management for the household): <form method="post"> <?php $products = $pages->find("template=product, sort=title"); foreach ($products as $product) { if ($product->amount == '') $product->amount = 0; $out = "<li>\n"; $out .= " <h3>{$product->id}&nbsp;&nbsp;<input type=\"number\" value=\"{$product->amount}\" name=\"product[]\" min=\"0\" style=\"width: 50px;\">&nbsp;&nbsp;{$product->title}</h3>\n"; $out .= "</li>\n"; echo $out; } ?> <button type="submit" name="submit" value="update" style="width: auto;">Bestand aktualisieren</button> </form> There is probably a better way, but I am not a programmer. May you explain why $id doesn't work without quotes? Thank you very much for your answer and help.
  3. Hello, I'm trying to get this code working, but I always get the following error message: Oh snizzle… Error: Exception: Unknown Selector operator: '[empty]' -- was your selector value properly escaped? field='1023', value='', selector: '1023' (in wire/core/Selectors.php line 218) #0 wire/core/Selectors.php (259): Selectors->create('1023', '[empty]', '') #1 wire/core/Selectors.php (145): Selectors->extractString('') #2 wire/core/Selectors.php (131): Selectors->setSelectorString(Object(Page)) #3 wire/core/PagesLoader.php (353): Selectors->init(Object(Page)) #4 wire/core/Pages.php (287): PagesLoader->find(Object(Page), Array) What am I doing wrong? Here is my code so far: if ($input->post->submit) { $amounts = $input->post->product; $products = $pages->find("template=product, sort=title"); if ($amounts) { foreach ($amounts as $index => $amount) { $id = $products[$index]; $pages->get($id)->setAndSave('amount', $amount); } } } Thank you for your help. Have a great day!
  4. Sorry for my late reply, so much to do. I just had to write to you cause your idea helped me thinking in the right direction. Thanks again! ?
  5. Hello to the forum, since recently I get this notice when I create a new page with definded parent templates and children templates: Notice: Trying to get property 'noChildren' of non-object in D:\xampp\htdocs\processwire-dev-3.0.170\wire\modules\PagePermissions.module on line 821 Line 821 of PagePermissions.module says: if($page->template->noChildren) { ... Any idea of what I could do or causes this notice? Thank you very much in advance.
  6. It's maybe the double use of 'updateprofile' for form id and button name.
  7. @BitPoet Thank you for your module! I have a small question about how to change my validation hook when fields are repeated via FormBuilderMultiplier and the name of the fields changes e.g. will be increased by number. I am getting the following notice (obviously the validation doesn't work, because the field name will not be increased with the ascending number created by FormBuilderMultiplier) Notice: Trying to get property 'value' of non-object in /.../site/templates/form-builder.inc on line 104 $forms->addHookAfter('FormBuilderProcessor::processInputDone', function($event) { $form = $event->arguments(0); if($form->name != 'tour-registration') return; $date_of_rabies_vaccination = $form->get('date_of_rabies_vaccination'); $dorv = $date_of_rabies_vaccination->value; // line 104 in form-builder.inc if($dorv > time()) { $date_of_rabies_vaccination->error(__("The date can not be in the future.")); } else if($dorv > strtotime("-21 DAYS")) { $date_of_rabies_vaccination->error(__("The date of the last rabies vaccination must be at least 21 days ago.")); } else { // vaccination date was more than 21 days ago } }); So how can I iterate resp. increment the field name in my hook? Thank you very much for your help. My environment: ProcessWire 3.0.161, FormBuilder 0.4.0 and FormBuilderMultiplier 0.0.6
  8. Sorry for my delayed answer and thank you for pointing me into the right direction. I have now deleted the assigned template in the database and could empty the trash. Thank you again and have a good day
  9. Thank you very much. Deleting the cache, clearing the browser cache and refreshing the PW-admin didn't help. Where do I find the modules cache?
  10. Hello, I get the following warning when I open the page tree: PagesLoader: You must assign a template to the page before setting custom field values (title__data) [pageClass=Page, template=] There is one page in the trash which I can't delete. I always get the message that the trash bin is empty (but there is still a 1 near the trash icon). How can I fix that? Thank you very much for your help.
  11. Thank you very much again. I have checked and unchecked these options but it doesn't work for me. But the Page Reference works perfectly: <a href="<?php echo $page->link->url; ?>"><?php echo $page->link->title; ?></a>
  12. Thank you for testing it, Adrian! I will try to find out why it isn't working for me. It's just a local page to play and to get deeper into PW.
  13. Hello adrian, thank you again for your quick reply. I have tested your code but the field outputs nothing now. However, I will test the Page Reference field tomorrow. Might be a better option <a href="<?php echo $page->AssistedURL; ?>"><?php echo $pages->get($page->AssistedURL)->title; ?></a>
  14. Hello gmclelland, thank you for your reply and the TracyDebugger tip. I think my approach is probably going in the wrong direction... I just wanted to have an input field to insert a link to another page or an anchor or select a page via the menu tree. That's why I decided to use this module. This <a href="<?php echo $page->AssistedURL; ?>"></a> outputs this: <a href="/processwire-test/page1/"></a> which is fine so far but I'd like to have the page name (or a custom text) within the <a></a> tags. Is there a better way to achieve that? Most probably Thank you again.
×
×
  • Create New...