I ran into a situation where I have a FileField in a Field Group midway through a multistep form and I wasn't able to upload a file. I would get this error:

An HTTP error 0 occurred.
/filefield/ahah/survey/field_my_survey_field/0

I have attached a patch that seems to fix the problem.

I am testing with FileField 6.x-3.5.

CommentFileSizeAuthor
multistep-filefield.patch821 byteschey
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rogerpfaff’s picture

Which version of multistep do you have installed? In my 6.x-1.4 I can't apply the patch against multistep.module because your the lines you changed are not in the file.

EDIT: ok, I've found out that you patched against the dev version. will do the changes by hand in my 1.4 release.

chey’s picture

@rogerpfaff Let us know how you make out.

rogerpfaff’s picture

Unfortunately the change did not solve my problem. I tried it with and without fieldgroup and the error must be somewhere else. There are several issues with the http error 0 and I really hoped this one would be the solution but it's not.

Though it must be a problem with the multistep because when I use it the error appears if not it's working. Also when I set the filefield to 'All' in the multistep configuration the field disappears and is visible when I switch to the complete form.

chey’s picture

@rogerpfaff Have you tried the dev code along with the patch?

rogerpfaff’s picture

Hi chey,

I've tested with the dev version and it works like a charm. :) thanks for the good work.

jhm’s picture

Isn't this more an issue with filefield since it is not passing in the current step?

I added the following test to multistep.module:_multistep_get_current_step

  //
  // filefield/ahah/article/field_image/X is missing the step in the URL
  // 
  if(arg(1) == 'ahah') {
      $step = array_pop(explode('/',$_SERVER['HTTP_REFERER']));
      if(is_numeric($step)) return $step;
  }
chey’s picture

FileField has gone through a couple releases since I initially posted this. I went back and re-tested Multistep dev with the latest version of Filefield (6.x-3.7) and there appears to be no longer an issue. For me, it still did not work for Multistep 6.x-1.4 though.

Can anyone confirm this?

vkareh’s picture

Status: Needs review » Fixed

Code in #6 is right. Actually, it's multistep's job to figure out which step does each field belong to. FileField is compliant with CCK's API, so Multistep should be aware of it. In any case, the 6.x-dev version of Multistep already verifies if it's an AHAH call and then asks CCK which step does it belong to.

FileField will not work on 6.x-1.4, since this change wasn't accounted at the time of release. Adding the code in #6 should fix it for most cases.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Sansui’s picture

#6, thank you so much :) I wasn't using the latest dev version and couldn't figure out why filefields were breaking in my node form. What a relief!