2014-01-14 35 views
1

冲突的段落(下一行),我有这样的jQuery代码文字区域与jQuery的

setInterval(function() { 
     if(yo.getTime() <= d5.getTime() && yo.getTime() <= d.getTime()){//compare yo time variable with current time variable(d) and also with the end time(so that the textboxes dont exceed the endtime) 
      <% 
      ResultSet rsta2=st.executeQuery("SELECT * FROM user_start where date='"+date+"' ");%> //A table which contains data typed in the textbox(In my case I have 12 data columns hence the counter,for 6 users). 
      <% while(rsta2.next()){%> 
       var freq=$('#freq').val();//freq=30 
       freq=parseInt(freq); 
       //appending to the body of the html 
       var newTextBoxDiv = $(document.createElement('div')).attr("id", 'TextBoxDiv' + counter); 
       newTextBoxDiv.after().html('<pre><div><label style="float:left;">'+yo+'</label></div><textarea rows="15" cols="70" name="textbox' + counter + '" id="textbox" ><%=rsta2.getString("data")%></textarea></pre><input type="hidden" name="timer' + counter + '" id="timer' + counter + '" value="'+msToTime(yo.getTime())+'"/>'); 
       newTextBoxDiv.appendTo("#TextBoxesGroup"); 
       yo.setMinutes(yo.getMinutes() + freq); 
       counter++; 

该代码添加文字区域后,每半hour.This部分works.Next当我在textarea的文本添加例如 enter image description here

无文本段落格式(连续文本),这也适用,即它被检索从数据库恢复到没有问题的textarea的,和文字区域持续半小时后出现。 现在的问题出现时,检查该图像enter image description here

正如你可以看到我已经写在段落这里形成,这将进入数据库,但一旦进入到下一行有在这两个词之间没有空间该数据库,例如这行ldhnjglfdhngfdhngjk fdbnvjcxmbnjvm被保存在数据库中作为ldhnjglfdhngfdhngjkfdbnvjcxmbnjvm(连续字符串)。但主要问题出现时,在textareas上取回它,textareas根本不出现。根本没有。没有一个textarea.What正在创造一个冲突?

UPDATE

我试图把在textarea的hello1,hello2,hello3 3条单独的线,我得到这个错误enter image description here

回答

1

我不知道,因为有依赖关系究竟是引起此问题我们看不到。这可能是你的html代码的问题,但这将是相当棘手的发现。然而,有些事情可能会有所帮助:

  1. 打开开发工具在浏览器(如按Ctrl + + 在Chrome或Firefox)你看到任何错误时,文本区域不会出现(例如,内部服务器错误 - 500)?

  2. 打开浏览器中的开发工具并转到网络选项卡,当没有出现文本区域时,是否会看到预期的网络数据将返回给浏览器。

  3. 是否有可能将网络数据粘贴到一个jsfiddle(例如),看看它是否呈现正确。

  4. 可以比较数据库中导致数据库失败的数据和成功的数据,并确定导致失败的最小案例吗?

  5. 您可以采取其他措施来减少问题空间。

+0

我已经更新了我的问题,我告诉你什么,从我所看到的段落(nextline)做 –

+0

创建一个问题 –

+0

@ user3040563你试过nl2br后发现错误。看到这里:http://stackoverflow.com/a/5049048/746754 – acarlon