Problems, need help? Have a tip or advice? Post it here.
2 posts Page 1 of 1
Hello,

I have a form (normal html) for date selection on my page. After both date fields have been filled, the form is submitted and couch shows the content all pages within that date range (one page is one row in a table).

The first field of the page is this dropdown:

Code: Select all
<cms:input class='statusdummy' name="<cms:show 'statusdummy' /><cms:show k_page_id />" type='dropdown' opt_values='offen|in Evidenz|genehmigt TL|genehmigt|abgelehnt|storniert' opt_selected="<cms:show status />" />


When I open the page normally, this works as expected, with the last saved value being selected in the dropdown.

However, when I change the date, after post the opt_selected does not seem to work, it always shows the first value as selected (offen).

Any ideas?

Bonus weirdness: At first, the selection for the date range worked like this:

Code: Select all
<cms:pages masterpage='formular.php' custom_field="erl='ok' | internesdatum >= <cms:show archivstartdatum /> | internesdatum <= <cms:show archivenddatum />" >   


archivstartdatum and archiveenddatum were set with cms:set from the php $POST variables.

I now instead put the $POST variables into $SESSION variables and made the page refresh afterwards one time (and instead have archivstart/enddatum couch variables be set from the $SESSION variables.

Code: Select all
if ($_POST['archivstartdatum']) {
         $_SESSION['archivstartdatum'] = $_POST['archivstartdatum'];
      }
      if ($_POST['archivenddatum']) {
         $_SESSION['archivenddatum'] = $_POST['archivenddatum'];
}
if ($_POST['archivstartdatum'] && $_POST['archivenddatum']) {
      header('Location: index_zes.php');


After putting the POST variables into SESSION variables and after having couch put them into couch variables, I unset the Session variables.

With the additional refresh, the dropdowns again show the correct value, HOWEVER: If I now change the dropdown value and submit the page form (this is a databound form), I get the Security Token does not tally for that action error.

After I reverted back (no additional refresh, set couch variables from $POST), changing the dropdown value and then saving works correctly (but the shown dropdown value always is "offen" after POST).

Edit: I now believe this is the same error as here: viewtopic.php?f=4&t=11239&p=29553#p29553

By clearing out the Session variables, the number of pages displayed after submit would change (to 0 displayed rows/pages because the Session variables are empty). If I don't remove the Session variables (so that the amount of pages shown stays the same after a page refresh), it works as expected.
Ok, I have run into this issue again and I'm quite sure now that it's definitly an issue with couch.

I made a snippet that captures output of a pages query into a variable (ajax output) and does some stuff, so it will eventually return a valid json object.

One of the fields of the pages is a dropdown, and opt_selected should be the current selected value.

If I do the ajax call using GET it works fine (json response includes the selected indicator for the correct option). If I call the ajax using POST, the selected indicator is not included in the response. Everything else works fine, it just seems that opt_selected breaks if you use POST for some reason.... Even if I set a hardcoded value for opt_selected, it still does not work.

Relevant JSON response using GET:
Code: Select all
"<select name=\"statusdummy11070\" id=\"statusdummy11070\" class=\"statusdummy\" > <option value=\"offen\" >offen</option> <option value=\"in Evidenz\" >in Evidenz</option> <option value=\"genehmigt TL\" >genehmigt TL</option> <option value=\"genehmigt\" selected=\"selected\">genehmigt</option> <option value=\"abgelehnt\" >abgelehnt</option> <option value=\"storniert\" >storniert</option> </select>",


Response using POST:
Code: Select all
"<select name=\"statusdummy11070\" id=\"statusdummy11070\" class=\"statusdummy\" > <option value=\"offen\" >offen</option> <option value=\"in Evidenz\" >in Evidenz</option> <option value=\"genehmigt TL\" >genehmigt TL</option> <option value=\"genehmigt\" >genehmigt</option> <option value=\"abgelehnt\" >abgelehnt</option> <option value=\"storniert\" >storniert</option> </select>",
2 posts Page 1 of 1

Who is online

In total there are 5 users online :: 0 registered, 0 hidden and 5 guests
(based on users active over the past 5 minutes)

Users browsing this forum: No registered users and 5 guests