1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Progress Bar with AutoValidator?

Discussion in 'XenForo Development Discussions' started by Jaxel, Jul 7, 2016.

  1. Jaxel

    Jaxel Well-Known Member

    So, I have a form. This form has an "duperow" button which basically duplicates a text entry field. Theoretically, a user could submit a large amount of rows to this form. In this case, lets say the user is submitting 1000 strings.

    This form is submitting these fields as a simple array. I am then taking these inputs, looping through them, and submitting them to the matching datawriter. This of course means there are 1000 datawriter actions in this submit. This all works fine.

    The problem is, this action could take a bit. With 1000 writes, it could take 60 seconds before its done. So the end user is sitting at a blank screen, not knowning whats going on for quite a bit.

    For examples sake, lets say the code below is what I am doing:
    Code:
    if ($this->_request->isPost())
    {
        $entries = $this->_input->filterSingle('entries', XenForo_Input::ARRAY_SIMPLE);
     
        foreach ($entries AS $entry)
        {
            $model->insertEntry($entry);
        }
     
        return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS,...);
    }
    What I would like to do is add a progress bar to this. Anyone got any ideas?
     
  2. Nobita.Kun

    Nobita.Kun Well-Known Member

    I think this library might be help. library/Zend/ProgressBar and this class Zend_ProgressBar_Adapter_JsPush very usefull.
     
  3. Jaxel

    Jaxel Well-Known Member

    I've always thought Zend's API docs were confusing as hell...
     

Share This Page