Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6587415
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:54:51+00:00 2026-05-25T16:54:51+00:00

I have this form class: class NewsItemForm extends BaseNewsItemForm { public function configure() {

  • 0

I have this form class:

class NewsItemForm extends BaseNewsItemForm
{
  public function configure()
  {

    $this->useFields(array('title', 'picture', 'text'));

    $this->widgetSchema['picture'] = new
sfWidgetFormInputFileEditable(array(

      'file_src'  => '/uploads/'.$this->getObject()->getPicture(),
      'is_image'  => true,
      'edit_mode' => !$this->isNew(),
      'template'  => '<div>%file%<br />%input%<br />%delete%
%delete_label%</div>',
    ));

    $this->validatorSchema['picture'] = new sfValidatorFile(array(
                          'mime_types' => 'web_images',
                          'path' => sfConfig::get('sf_upload_dir'),
                          'required' => true,
                          'validated_file_class' =>
'myValidatedResizedFile'));

  }

}

I submit the form correctly, after that, the same form is showed this
time to update the data submited, but the problem is it’s not
retrieving the info about the picture, I mean, the picture is showed
but next to the “Browse..” button there is written “No file chosen”,
in fact, if I try to submit the form I get the error message
“Required” for the picture field.

Any idea?

sf 1.4.

Regards

Javi

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T16:54:51+00:00Added an answer on May 25, 2026 at 4:54 pm

    Just add ‘required’ => $this->isNew():

     $this->validatorSchema['picture'] = new sfValidatorFile(array(
                              'mime_types' => 'web_images',
                              'path' => sfConfig::get('sf_upload_dir'),
                              'required' => true,
                              'required' => $this->isNew(),
                              'validated_file_class' =>
    'myValidatedResizedFile'));
    
      }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following class for a form: class Application_Form_ContactForm extends Zend_Form { public function
Problem 1. I have this class: public class ContactGroups { // Form an array
I have a form that looks like this: class SampleForm(forms.Form): text = forms.CharField(max_length=100) In
I have this form class public partial class Form1 : Form { public Form1()
I have this class: Public Class common Public Function NumbersOnlyEvent(ByVal CtrlName As String, ByVal
Say I have this simple form: class ContactForm(forms.Form): first_name = forms.CharField(required=True) last_name = forms.CharField(required=True)
I have a Django my_forms.py like this: class CarSearchForm(forms.Form): # lots of fields like
I have this form submit code: Event.observe(window, 'load', init, false); function init() { Event.observe('addressForm',
Hello i have this form filling javascript: function onLine(code,nn) { document.writeform.bericht.value+=code; document.writeform.bericht.focus(); document.writeform.nickname.value+=nn; write1();
I have this form class : class MyForm(forms.Form): def __init__(self, *args, **kwargs): self.notvalidate =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.