-
Posts
533 -
Joined
-
Last visited
Everything posted by adrianmak
-
is it possible to not show page submission in page tree ?
adrianmak replied to adrianmak's topic in General Support
it could be an option is there is not any other available options. -
I'm building a front-end simple enquiry form with only name, email, subject and message fields The submitted form data will be stored as page (or something else). To make use of the pw's core page api, i have to create a page template with mentioned fields. But any pw's page(s) should show on page tree. In instead I don't want the submission data shown on page tree, and write a admin module to retrieve submission page data.
-
now works! Another problem I found immediately, I opened firbug to change textfield value or a select option value, it still success to process Did I test CSRF the right way? search.php try { $q = $sanitizer->text($input->post->search_keywords); $t = $sanitizer->text($input->post->type); $o = $sanitizer->text($input->post->typeoptions); $session->CSRF->validate(); } catch(WireCSRFException $e) { echo "Processing aborted."; die(); } // if success, continue to process form data
-
I added form CSRF in my search form <form method='post' action='<?php echo $config->urls->root; ?>search/'> <input type='hidden' id='_post_token' name='<?php $this->session->CSRF->getTokenName(); ?>' value='<?php $this->session->CSRF->getTokenValue(); ?>' /> <input class='search__input' type='text' name='search_keywords' id='search_keywords' value='' /> <select class='search__select' id='type' name='type'> <option value=''>All</option> <?php foreach($pages->get(1028)->children() as $category) { if($t==$category) $selected = "selected"; else $selected = ""; echo "<option value='{$category->id}' {$selected}>{$category->title}</option>"; } ?> </select> <!--<input type='text' name='typeoptions' id='typeoptions'>--> <span class='search_options'></span> <input class='search__button' type='submit' value='Search' /> </form> But, the outputted two values of hidden field are empty
-
understood ~~~~~~
-
My code is working. However, I want the form to retain previous user selection states after a keyword search submission
-
Let me state more clearly The search form started for two fields only, (3rd field is not on the page. i.e it is not hide by css) 1st field, a text input field 2nd field, a select option field. When a user select an option in 2nd field, based on the option value, a ajax query to back-end to retrieve options, which will return 3rd select option thru ajax. the javascript script $(document).ready(function() { toggleFields(); $('#type').change(function() { toggleFields(); }); }); function toggleFields() { var query_value = $('#type').val(); if ($('#type').val() == '') { $("span.search_options").hide(); } else { $.ajax({ type: "POST", url: "/query.php", data: { query: query_value }, success: function(html) { //console.log(html); $("span.search_options").html(html); $("span.search_options").show(); } }); } //console.log(query_value); } query.php <?php // ProcessWire bootstrap include('./index.php'); $out = ""; $query_string = wire(sanitizer)->text($wire->input->post->query); $categories = wire(pages)->get($query_string)->children(); $out = "<select class='search__select' id='typeoptions' name='typeoptions'>"; foreach($categories as $category) { $out .= "<option value='{$category->id}'>{$category->title}</option>"; } $out .= "</select>"; echo $out; initial search form <form method='post' action='<?php echo $config->urls->root; ?>search/'> <input class='search__input' type='text' name='search_keywords' id='search_keywords' value='' /> <select class='search__select' id='type' name='type'> <option value=''>All</option> <?php foreach($pages->get(1028)->children() as $category) { echo "<option value='{$category->id}'>{$category->title}</option>"; } ?> </select> <span class='search_options'></span> <input class='search__button' type='submit' value='Search' /> </form>
-
How ? could u mind post some sample code ?
-
Do u mean rebuild the search form with the populated form variables in the search template ?
-
My site have a search Changing value of a select option field will dynmaic query (ajax) in the back-end to show the 3rd select option When search is submitted, the form will reset to initial ( the first screen) I want to keep the last form selected state, even the form is submitted.
-
My pw website has few templates home.php basic-page article-page photo-page picture-page The site has a search with few option provided. When a user search by all, the search will filter only artilce-page, photo-page and picture-page instead of building selector with hard-code template i.e. $pages->find("template=article-page|photo-page|picture-page") could selector be more dynamic ? let say, get all site templates and excluded those templates, in this case, home.php and basic-page will be excluded in the selector
-
how do u manage existing website hyperlinks?
adrianmak replied to adrianmak's topic in General Support
it looks powerful ~~~~~ -
I see. From OP, using login redirect to redirect to dashboard. if($page->template=="admin" && $page->id == 2) $session->redirect($pages->get(1234)->url) what is the $page->id == 2 ?
-
I installed Pete's Dashboard module. It behave slightly different from Macrura posted screenshot After logged in, Dashboard is not the default page and, the Dashboard tab is not in the first order.
-
does it support multiple branches ?
-
I'm working with a client which he want to revamp an existing proprietary php cms How could I manage existing website links redirect to new website The old website link has three main php with paramater for each content i.e http://old.website.com/special.php?id=6 http://old.website.com/list.php?id=7 http://old.website.com/msg.php?id=19 any suggestion to handle existing link ? redirect all existing link to homepage of new website or redirect each link one by one
-
will media manager support, beside self-uploaded videos, how about video content provider like youbue. For instance, add a youtube link in media manager Such that I can browse youtube videos added in the media repository
-
How you implement shortcut widgets? Two different template file and included in the dashboard page ? And, the those site shortcuts links are hard-coded in template?
-
I extracted in pw 2.7.2. However pw is not recognized a new module is available
-
which admin theme used in the screen shot ?
-
understood~~~~~
-
It seems that the count is not work for $page->next and $page->prev Here is a cross reference post https://processwire.com/talk/topic/11900-regarding-api-page-prev-and-page-next/?hl=prev Using the count, always returned 0, no matter there is prev or next page is available. i.e. if (count($page->prev)) { // this always 0 even though there is no prev page }
-
I see.....
-
Here is a segment of code $childpages = $pages->find("categories=500, sort=-post_date, limit=10"); if($childpages) // do something if found else // do something if not found I found that the $page->find() always TRUE even though there is no page with field categories with value of 500