return $r; } /** * @param int $page 页数 * @param int $pagesize 每页显示数量 * @return mixed */ function link_find($page = 1, $pagesize = 100) { $arr = link__find($cond = array(), array('rank' => -1), $page, $pagesize); return $arr; } /** * @param $id * @return bool 返回FALSE失败 TRUE成功 */ function link_delete($id) { if (empty($id)) return FALSE; $r = link__delete(array('id' => $id)); link_delete_cache(); return $r; } //--------------------------kv + cache-------------------------- /** * @return mixed 返回全部友情链接 */ function link_get($page = 1, $pagesize = 100) { $g_link = website_get('friends_link'); if (empty($g_link)) { $g_link = link_find($page, $pagesize); $g_link AND website_set('friends_link', $g_link); } return $g_link; } // delete kv and cache function link_delete_cache() { website_set('friends_link', ''); return TRUE; } ?>javascript - How to implement custom fallback function with input fields, text and submit button - Stack Overflow
最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to implement custom fallback function with input fields, text and submit button - Stack Overflow

programmeradmin2浏览0评论

I'm new to Dropzonejs and javascript/jQuery. I have spent some time playing with it and set up a dropzone which works great, but I need to create custom fallback function with 2 text inputs, 1 textarea, 1 checkbox and a submit button.

I do not now what to do next after I have put

<div class="fallback"></div>

into my form.

I have also created:

fallback: function() {

} // end of fallback

in options.mydropzone

Here is where I'm stuck. I need some hints to plete me custom fallback function.

I'm new to Dropzonejs and javascript/jQuery. I have spent some time playing with it and set up a dropzone which works great, but I need to create custom fallback function with 2 text inputs, 1 textarea, 1 checkbox and a submit button.

I do not now what to do next after I have put

<div class="fallback"></div>

into my form.

I have also created:

fallback: function() {

} // end of fallback

in options.mydropzone

Here is where I'm stuck. I need some hints to plete me custom fallback function.

Share Improve this question edited Sep 3, 2013 at 11:41 rafjon asked Sep 3, 2013 at 11:15 rafjonrafjon 31 silver badge3 bronze badges 2
  • A fallback from what, to what and when? – user2417483 Commented Sep 3, 2013 at 11:24
  • Sorry, when Browser does not support File API (drag&drop) I want to display a custom form e.g. IE9 users and safari < 6 do not get drag & drop form to submit. So I want to use fallback function in Dropzonejs and create custom upload form. – rafjon Commented Sep 3, 2013 at 11:35
Add a ment  | 

2 Answers 2

Reset to default 4

Dropzone actually does this out of the box, you do not need to create this behavior. You just have to place a div with class='fallback' within the form, that holds an input for older browsers:

  <form method="POST" action="/upload" class="dropzone">
    <div class="fallback">
      <input type="file" name="file" />
      <input type="submit" />
    </div>
  </form>

Wrap your current form within a div

<div id="generalForm">
<form name='form1' .....>
</div>

Create a second form that you want to use as the fallback and wrap that in a div also

<div id="specialForm" style='display:none'>
<form name="form1" .... >
</div>

In your fallback function you would use

fallback: function() {
  document.getElementById('generalForm').style.display="none";
  document.getElementById('specialForm').style.display='block';
}

Is that what you are wanting?

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论