Jump to:

2011 Posts in 1436 Topics by 620 members

Form Questions

SilverStripe Forums » Form Questions » UploadField return not found error

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

Page: 1
Go to End
Author Topic: 364 Views
  • joanef2
    Avatar
    Community Member
    1 Post

    UploadField return not found error Link to this post

    Hi everyone!

    I'm trying to deal with this problem since a week!
    I create a Form (that i render with a custom template) with an UploadField
    When i choose a file to be uploaded, the progress bar feel to 100% and the UploadField return 'Not Found' error
    So tri to dig some little with Charles Proxy and found that SS return an [User Warning] popCurrent called on ModelAsController controller, but it wasn't at the top of the stack" error!

    Didn't find any way to fix this error
    I'm using SS 3.0.5

    Here is my Form definition:

    function RegisterForm(){
       $fields = new FieldList(
          // $photoField = new ImageUploadField('PhotoProfil', ''),
          $photoField = new UploadField('PhotoProfil', ''),
          new TextField('Pseudo'),
          new PasswordField('Password'),
          new TextField('Ville')
       );
       
       
       $validator = new RequiredFields('Pseudo', 'Password', 'BirthDay', 'Ville', 'Sexe', 'Profession', 'Pays', 'DepProv', 'chk');
       $actions = new FieldList(
          new FormAction('doInscriptionForm', "ENVOYER")
       );
       $myform = new Form($this, 'RegisterForm', $fields, $actions, $validator);
       
       return $myform->renderWith(
          '',
          'Form'
       );
    }

    And the custom InscriptionForm template:

    <form id="register-form" class="ui_left" $FormAttributes >   
          <% if Message %>
           <p id="{$FormName}_error" class="message $MessageType">$Message</p>
          <% else %>
           <p id="{$FormName}_error" class="message $MessageType" style="display: none"></p>
          <% end_if %>
          
          <div class="register_img ui_left">
             $Fields.dataFieldByName(PhotoProfil).FieldHolder
          </div>
          
          <div id="pseudo_div" class="register_form ui_left">
             <label>Pseudo*</label>
             <input name=%26quot%3BPseudo%26quot%3B type="text" id="pseudo_input" class="register_form_input" value="" placeholder="Pseudo" />
          </div>
          <div class="clear"></div>
          
          <div class="register_form ui_left">
             <label>Créez un mot de passe</label>
             <input name=%26quot%3BPassword%26quot%3B type="text" class="register_form_input" value="" />
          </div>
          
          <div class="clear"></div>
          
          $Fields.dataFieldByName(SecurityID)
          <div class="register_form ui_left">
             <label>Ville</label>
             <input name=%26quot%3BVille%26quot%3B type="text" class="register_form_input" value="" />
          </div>
       
    </form>

    I also find that when i don't render the form without my custom template the UploadField work fine
    Please help me find a solution

    364 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.