Jump to content

da²

Members
  • Posts

    392
  • Joined

  • Last visited

  • Days Won

    5

da² last won the day on December 17 2024

da² had the most liked content!

1 Follower

Recent Profile Visitors

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

da²'s Achievements

Sr. Member

Sr. Member (5/6)

266

Reputation

  1. It works only if I set multiple to true, but this is a single file upload: $zipUpload = new InputFile("zipFile"); $zipUpload->setMultiple(false); // Rule 'allowedFileSize' not working with "false" $zipUpload->showClearLink(true); // No link displayed too $zipUpload->setLabel("label"); $zipUpload->setRule('allowedFileSize', '524288000'); // Not taken into account except with multiple files $zipUpload->setRule('allowedFileExt', ['zip']); $zipUpload->setRule('required'); Oh, this works if I fill the english title of french language! Is it expected? Usually in ProcessWire the field first language value is used as default if second one is empty, like here: In my language selector for example, it works like this, all languages are found and usable. But at least I know how to fix this on my side. 😉
  2. Thank you @Juergen for the fixes. Sorry not to reply before but I have few free time. ^^ I found more issues: File upload is limited to 500 MB: $zipUpload->setRule('allowedFileSize', '524288000'); But I can add a file larger, the form is valid and the upload starts, but then the server is not happy: With module FrontendLoginRegister, in Account Settings I add Language field. I have 2 languages, french and english, french is default. The form displays the 2 languages only if user is actually using french, when using english, only english is listed in the Select field. If user selects english and save, it works. If user selects french it is not saved. I try to investigate the code quickly, only to find that in Select::___renderSelect(), when user is using english, $option->render() returns an empty string for french.
  3. And another issue. First time I submit the form, after isValid() I call showForm(true), so the form shows with the last value entered. I see the notice "Thank you for your message", and the URL segment is still there. I hit submit a second time and get a 404 page (from my code) because the URL segment is removed.
  4. Reason is the option in PW admin: I always check to end segments with a slash, if I check "no" the form works.
  5. Hello, On a page with an url segment, the form is never valid. It's a simple form with an InputNumber. If I remove the segment it works, if I add it isValid() is always false. Another minor issue, even if an InputFile has setMultiple(false), I can drag and drop several files on it, I don't know if you can do something for this.
  6. OK, but the random bug is still there. Don't be in the urge to investigate this, I'll go for a classic HTML form because I have to finish this ASAP.
  7. enum TournamentType:string { case MYSTERY = "Mystery"; case PKO = "PKO"; case VANILLA = "Vanilla"; } class FilterSolvesForm extends AbstractFrontendForm { protected function buildForm(): void { $tournamentTypeSelect = new Select("tournamentType"); $tournamentTypeSelect->setLabel(__("Type de tournoi")); foreach (TournamentType::cases() as $tournamentType) { $tournamentTypeSelect->addOption($tournamentType->value, $tournamentType->value); } $this->add($tournamentTypeSelect); } } abstract class AbstractFrontendForm extends Form { public function __construct(string $id) { parent::__construct($id); $this->buildForm(); $this->addSubmit(); } private function addSubmit():void { $button = new Button('submit'); $button->setAttribute('value', __("Valider")); $this->add($button); } abstract protected function buildForm(): void; } // TEMPLATE PHP FILE $command = new SelectSolvesDatabaseCommand(1, 10); $filtersForm = new FilterSolvesForm("solvesFilterForm"); if ($filtersForm->isValid()) { // DevUtils::prettyPrintObject($filtersForm->getValue('tournamentType')); // $command->addFilter('tournamentType', $filtersForm->getValue('tournamentType')); } $filtersForm->showForm(true); $command->execute(); $solves = $command->getPaginatedSolves(); Twig::render('browse-solves', [ 'paginatedSolves' => $solves, 'filtersForm' => $filtersForm, ] );
  8. It's a simple Select: I tried again and find this is a random bug, sometimes it works, sometimes not. I made a video, we don't see the dropdown because I recorded only Firefox window, but I can confirm the list is always rendered in the same order as the top line "Mystery,PKO,Vanilla,", that is the order used to fill the Select element, so this is not a problem caused by a random order when initializing the form.
  9. I found in your code that it is $form->setAttribute('method', 'get'); (documentation needs an update 🙂 ). But now the page is empty after submission, empty head and body. I don't understand what's happening. EDIT: Looks like there is an exit() somewhere, because no code in my template is executed after $form->isValid() when I use GET method. 🧐
  10. Thank you @Juergen I edited my message with more questions while you were answering: Another thing, after form submission I'd like the form to be still displayed for another use, it is used to filter data in a table so it should always be visible. Actually after submission the form is hidden and replaced with the message "Thank you for your message.". I tried to use $form->showForm(true); but there is a bug, the value shown in the form is not always the value I selected before to submit (in a Select element). And another question, following the documentation I added $form->setMethod('get'); but get an error: "::setMethod does not exist or is not callable in this context"
  11. Hello, Is there a way to put some fields into a div, so I can manage form layout more precisely? Is it with the FieldsetOpen/FieldsetClose elements? EDIT: Another thing, after form submission I'd like the form to be still displayed for another use, it is used to filter data in a table so it should always be visible. Actually after submission the form is hidden and replaced with the message "Thank you for your message.". I tried to use $form->showForm(true); but there is a bug, the value shown in the form is not always the value I selected before to submit (in a Select element).
  12. This gives a warning, better like this: if (isset($_SERVER['REQUEST_URI']) && strpos($_SERVER['REQUEST_URI'], $this->wire('config')->urls->admin) === 0) { Will you publish a fix?
  13. This gives the same error. I fill this is related with the module because this is not the first time I bootstrap PW and never had an issue before to install this module. You are using REQUEST_URI, but when bootstrapping, isn't it expected that it's not defined? It's easy to test, just include PW index.php in any script and run it directly (no web page involved).
  14. Another question/issue. I'm starting a new project, it will include bootstrapping code. I made a simple test, and I get an error from FrontendForms, error comes from the include of index.php. The test script: <?php namespace ProcessWire; include __DIR__ . "/../vendor/autoload.php"; include __DIR__ . "/../index.php"; The error: Is it a bug or do I have to do anything to avoid this?
×
×
  • Create New...