Jump to:

1976 Posts in 1306 Topics by 607 members

Form Questions

SilverStripe Forums » Form Questions » Noob Form question

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 587 Views
  • YourMan
    Avatar
    Community Member
    5 Posts

    Noob Form question Link to this post

    Hi,

    I'm pretty sure this is very simple and I'm doing this horriblely wrong or something.

    What I'm try to do , Is that i have a form that submits an image.
    it then crops bits of the image into new images , i want to display these as the return of the submission of the form.

    what I'm not sure of how do do is to pass the paths to the images i have created to the template.
    Any help would be cool

  • swaiba
    Avatar
    Forum Moderator
    1769 Posts

    Re: Noob Form question Link to this post

    What I'm try to do , Is that i have a form that submits an image.
    it then crops bits of the image into new images , i want to display these as the return of the submission of the form.

    first part is with SimpleImageField or Uploadify, no idea about splitting the image up...

    what I'm not sure of how do do is to pass the paths to the images i have created to the template.
    You can pass data into a template in many ways, is this data written to the database? If so place...

    function CroppedImages() {
       return DataObject::get('MyCroppedImages');
    }

    if it isn't then simply place your data into the same structure manually...

    function CroppedImages() {
       $arr = array('data1','data2');
       $dos= new DataObjectSet();
       foreach ($arr as $str) {
          $do= new DataObject();
          $do->ImageName = $str;
          $dos->push($do);
       }
       return $dos;
    }

  • YourMan
    Avatar
    Community Member
    5 Posts

    Re: Noob Form question Link to this post

    Thanks swaiba for your reply.

    The area I'm really having problems with is the flow of returning a page after a form has been submitted.
    I'm not using a database , so the DataObjectSet is what i want alright thanks.

    The code I have so far returns a blank page:
    http://www.sspaste.com/paste/show/4d7674ab061a7

    myTemplate is just : <h1>hello</h1>

    after that, My problem now is accessing the DataObjectSet from the template, maybe a control loop , but not sure how to access arrays in the template language.

    587 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.