apeisa Posted February 16, 2012 Share Posted February 16, 2012 On upcoming ShoppingCheckout module I have quite few settings options. I thought that I get much nicer UI by providing some fieldsets there. I had quite a few debugging sessions to figure why my values didn't save. After first save they were there, but after you visited module again they were back to defaults. I have the usual $fields as InputfieldWrapper(); Then this is working code: $field = $modules->get("InputfieldText"); $field->attr('name', 'confirmationUrlSegment'); $field->attr('value', $data['confirmationUrlSegment']); $field->label = "UrlSegment for confirmation step"; $field->description = "This is only shown in the url."; $fields->add($field); But this is non-working code: $urls = $modules->get("InputfieldFieldset"); $urls->label = "Url segments"; $urls->set('collapsed', Inputfield::collapsedYes); $field = $modules->get("InputfieldText"); $field->attr('name', 'confirmationUrlSegment'); $field->attr('value', $data['confirmationUrlSegment']); $field->label = "UrlSegment for confirmation step"; $field->description = "This is only shown in the url."; $urls->add($field); $fields->add($urls); (I have more those UrlSegments, but simplified this with having only one). The UI and first "save" works nice, but somewhere there is problems that doesn't actually save the values. Link to comment Share on other sites More sharing options...
ryan Posted February 17, 2012 Share Posted February 17, 2012 Is this for a getModuleConfigInputfields function? I don't think I've ever tried fieldsets there, though I can't think of any reason why it wouldn't work. But if you don't mind going without fieldsets for a day or two, I can reproduce and fix it here. Link to comment Share on other sites More sharing options...
apeisa Posted February 17, 2012 Author Share Posted February 17, 2012 Yep, that's the method. It's pretty strange since values seems to be saved, but if load another page and then come back they are back to defaults. Without fieldsets it works fine. Link to comment Share on other sites More sharing options...
apeisa Posted February 17, 2012 Author Share Posted February 17, 2012 Ryan, thanks for the fix, it works now.. almost. If I have another fieldset later on, it will lose those values. My intended setup is acually like this (without initial wrapper): FIELDSET Textfield Textfield Textfield ENDFIELDSET FIELDSET FIELDSET Checkbox Checkbox ENDFIELDSET FIELDSET Checkbox Checkbox ENDFIELDSET ENDFIELDSET First fieldset saves ok, later ones fail. Next I tried it with this setup: FIELDSET Textfield Textfield Textfield ENDFIELDSET FIELDSET Checkbox Checkbox Checkbox Checkbox ENDFIELDSET Similar effect: first Fieldset saves ok, other one fails. But when I go this flat: FIELDSET Textfield Textfield Textfield ENDFIELDSET Checkbox Checkbox Checkbox Checkbox It does save all the values. Link to comment Share on other sites More sharing options...
ryan Posted February 17, 2012 Share Posted February 17, 2012 Sorry about that, I think I've got it fixed now if you want to try it again. Link to comment Share on other sites More sharing options...
apeisa Posted February 17, 2012 Author Share Posted February 17, 2012 Yeah, it works, thanks for fixing this! BTW: Github sending automatic email when you mention my @github-username is superb feature! Link to comment Share on other sites More sharing options...
Svet Posted March 9, 2014 Share Posted March 9, 2014 I am not sure how others get around this, but I found out that filters on your renderCheckout() function in ShoppingCheckout.module were not working. $this->input->urlSegment1 == $this->completedUrlSegment would not return the right values so the function always defaulted to ->renderInformation Here is how I fixed this part: public function renderCheckout() { if (strstr($this->page->url, 'confirmation')) { $out = $this->renderConfirmation(); } else if (strstr($this->page->url, 'payment')) { $out = $this->renderPayment(); } else if (strstr($this->page->url, 'completed')) { $out = $this->renderCompleted(); } else { $out = $this->renderInformation(); //$out = $this->page->url; } return $out; } See some other errors connected to the session and clicking the back button on the browser, but I will try to use this Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now