Search the Community
Showing results for tags 'select field'.
-
Hi, I can't get the value of the fields of the page whose id comes from the value of the select field. In fact the value I get is the id of the repeater field from an other table with several fields inside. <?php //I get the repeater field value $events= $page->evenement; //I get the different lines foreach ($events as $event){ //I get the value of the select field foreach ($events as $event){ $cat=$event->type; echo $pages->get($cat)->couleur;exit; And then my result is empty. I am now confused with all my trials... thank you
- 1 reply
-
- inputfield
- select field
-
(and 2 more)
Tagged with:
-
Hello all, I have a contact-form with a select field as Subject. The select field is defined as: += subject1= THE FIRST Subject subject2= THE SECOND Subject Now I call the contact-fom from another page with a get parameter "subject" : http://processwiresite.com/contact/?subject="subject1" I have a Hook defined to process the form "onRender" and I have got the get parameter and sanitized it, etc. Now the question is: How can I select the option based on the get parameter ? Thank you in advance Raul
-
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.
- 24 replies
-
- api
- front-end form
-
(and 1 more)
Tagged with: