Jump to content

onjegolders

Members
  • Posts

    1,147
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by onjegolders

  1. Thanks Wanze, the caching may be worth it by itself. Thanks again buddy.
  2. Yeah that sorted it thanks Wanze, I should have seen that! Do you know what differences there are between this implementation and using HTML2PDF? I have a very basic usage of that library and it seems to work "OK" but I'm guessing a PW way is better. Are there any other differences that you know of? Thanks again for all your hard work Wanze.
  3. Hi Wanze, thanks for all your work on this, I'm excited to try it out. Problem I have at the moment is the render call isn't outputting anything. I've definitely added my template in the module settings but there's no link or anything getting outputted. Have you seen this issue before? Thanks.
  4. I think this is to with the way MySQL is searched and I believe you can change the minimum word length in your server settings. Not sure if this will affect PW's use of search though. Edit: You'll also note for example that three-letter words are excluded on this forum.
  5. Yeah I don't think this exists at the moment but I can see why you'd want it. I think it's strange seeing radios without a default setting. Maybe it's something Ryan can add to the wishlist?
  6. Hi Lenoir, I think this has come up a few times and I don't think there is a way of setting a default in the admin side. What you can do however is use if/else statements in the template: if ($page->field == "very_important") { // do something } elseif ($page->field == "important") { // do something different } else { // user has either selected normal or left it blank so use normal }
  7. A huge thanks to Diogo who has been helping me debug this. He eventually found out the cause of the error was the $page->invoice_line->removeAll(); line. It seems to require a save() after this line and then a further save at the end. if ($error == 0) { $page->of(false); $page->invoice_line->removeAll(); $page->save(); $page->of(false); $page->title = $sanitizer->name($input->post->number); ... $page->save(); Could Ryan confirm this is the correct way? Diogo, mucho obrigado
  8. Hi yesjoar, i had pretty much the same issue here http://processwire.com/talk/topic/3403-creating-new-repeater-items-through-front-end-form/ Please note that I think you need to use ->removeAll() on existing repeaters, then save() then add in the new repeaters. (This is they way mine is working though there may be better ways)
  9. Thanks Ryan I ended up using a combination of jquery append (and remove) and the following for loop in PHP. $total = 0; for ( $i=0;$i<count($input->post->invoice_billable);$i++) { ${'rp'.$i} = $page->invoice_line->getNew(); ${'rp'.$i}->invoice_billable_line = $input->post->invoice_billable[$i]; ${'rp'.$i}->invoice_billable_amount = $input->post->line_value[$i]; In case that helps anyone out.
  10. Your closing </section> is also outside of the loop and should be moved inside.
  11. Thanks Adrian, I may well use that approach except I'm having to add rows of fields dynamically with javascript. I'm not sure how that would fit in with it. Otherwise it looks like a great solution.
  12. Thanks for looking. Still the values aren't getting transferred. Must be something completely different. I appreciate all of your help.
  13. OK thanks Soma. Edit: I'm getting the following error but I definitely have of(false) Error: Exception: Method Page::add does not exist or is not callable in this context Hi Wanze, it seems like this ought to work but for some reason it doesn't. I'll have to take a further look.
  14. I'm starting to follow what Wanze and Adrian are saying. Apologies, it's been a long day. Will try and get it to work.
  15. And if it's a single page field?
  16. Hi both of you, yes sorry, all these page fields are set to single.
  17. Hmmm it seems even with Diogo's code, the fields aren't getting updated. When the page is saved they display correctly on the form (so you'd think the values have been updated) but when I check in the admin, it's the old values still. I'm stumped
  18. Thanks Adrian, that's a really detailed and helpful post. I will take a look at Diogo's code - it could be very interesting indeed. Regarding having an actual page for the page field, all those pages already exist. In theory I think I should be able to just specify the page ID for that field so if I wanted to hardcode it I could say $page->page_field = 1023. Is that not the case?
  19. Thanks 3fingers, I'm not quite sure how that work, I'm pretty sure that PW ought to be able to accept select elements? In fact I've used them before as select multiple and it has worked. It just seems strange as after much debugging, I have checked and $input->post->invoice_terms are getting set correctly but then they're not being passed to the DB.
  20. Hi guys, Am having an issue with a front-end form where page-fields via a select field are not getting updated. Could someone check that my syntax is correct? I'm not really sure why they're not matching up. The form part: <label for="edit_terms">Terms</label> <select name="edit_terms"> <?php foreach ($pages->find("template=payment_term") as $term) { ?> <option value="<?php echo $term->id; ?>"<?php if ($term->id == $page->invoice_terms->id) {echo " selected";} ?>><?php echo $term->title; ?></option> <?php } ?> </select> <label for="edit_status">Status</label> <select name="edit_status"> <?php foreach ($pages->find("template=invoice_status") as $status) { ?> <option value="<?php echo $status->id; ?>"><?php echo $status->title; ?></option> <?php } ?> </select> The editing page via API part: <?php $error = 0; $out = ""; // Form was submitted if ($input->post->estimate_edit_submit) { $page_name = $sanitizer->pageName($input->post->number); $p = $pages->find("template=estimate, name=$page_name")->remove($page); if (count($p)) { $error = 1; $out = "Sorry, that page name is already taken..."; } if ($error == 0) { $page->of(false); // $page->parent = $pages->get("/estimates"); // $page->template = "estimate"; $page->title = $sanitizer->name($input->post->number); $page->name = $sanitizer->pageName($input->post->number); $page->invoice_number = $sanitizer->name($input->post->number); $page->invoice_date = $sanitizer->text($input->post->date); $page->invoice_client = $sanitizer->text($input->post->client); $page->invoice_terms = $sanitizer->text($input->post->edit_terms); $page->invoice_status = $sanitizer->text($input->post->edit_status); $page->invoice_line->removeAll(); $total = 0; for ( $i=0;$i<count($input->post->invoice_billable);$i++) { ${'rp'.$i} = $page->invoice_line->getNew(); ${'rp'.$i}->invoice_billable_line = $input->post->invoice_billable[$i]; ${'rp'.$i}->invoice_billable_amount = $input->post->line_value[$i]; $total += $input->post->line_value[$i]; } $page->invoice_total = $total; $page->save(); $out = "Estimate saved successfully"; } } All the text fields are getting updated but all three select fields (client, terms and status) aren't updating. I have an almost identical template for create instead of edit and everything works fine. Been scratching my head now for a good few hours, can anyone see anything wrong with the way I'm using the API? Thanks.
  21. Okay, think I'm almost there, I didn't actually realise there was proper docs about this http://processwire.com/api/fieldtypes/repeaters/ so apologies there! Having a few issues implementing multiple repeater items from the same form and using js to append but slowly getting there.
  22. Was just wondering if anyone had any experience adding repeater items to a new page from a front-end form? The repeater consists of two fields, one a page field and the other a simple text value. I'm unsure how I'd go about adding those values on a new page save()? Thanks, as always.
  23. Looks really interesting Diogo! Good find.
  24. Surprised no-one has gone for this (maybe have by PM). The hard bit will definitely be the content approval system.
×
×
  • Create New...