Forum Moderators: open

Message Too Old, No Replies

problem with getting data from database to a textarea

         

Na_Sait

5:56 am on Mar 20, 2004 (gmt 0)

10+ Year Member



Hi all,

I have ran to a problem not getting data from my SQL databse table to a textarea on my html file. Any help would be appreciated. My java script is as follow:

<TR><Td><FONT COLOR="#000080">Customer Remarks:</Font>
<TD><textarea name="customer_remarks" size=20 maxlength=50
<%if (repair.getCustomerRemarks()==null) %>value=""<%else%>value=<%=repair.getCustomerRemarks()>></textarea>

MWpro

6:45 am on Mar 20, 2004 (gmt 0)

10+ Year Member



Welcome to WebmasterWorld!

To display text inside a textarea, you cannot use the "value" attribute, but must put the contents inside of the textarea tags.

example:

<textarea>
text here
</textarea>

So you would have to fix up that if statement and put it within the textarea tags for it to work.

Na_Sait

6:31 pm on Mar 20, 2004 (gmt 0)

10+ Year Member



Thanks for replying, i will take your point.

Na_Sait

2:54 pm on Mar 22, 2004 (gmt 0)

10+ Year Member



Thanks a lot MWpro for the solution you gave me. It works perfectly well! one problem arised though is that after i press the delete button for deleting records on the html the 'onFoucus=""' still there. any idea how can i fix it.....

<TR><Td><FONT COLOR="#000080">Customer Remarks:</Font>
<TD><textarea name="customer_remarks" rows="3" cols="30">
<%if (repair.getCustomerRemarks()==null) %>onFocus=""<%else%><%=repair.getCustomerRemarks()%></textarea>

ajkimoto

5:48 pm on Mar 22, 2004 (gmt 0)

10+ Year Member



It looks like your onfocus() is outside of the textarea open tag ( ...cols="30"> )

<textarea name="customer_remarks" rows="3" cols="30">
<%if (repair.getCustomerRemarks()==null) %>onFocus=""<%else%><%=repair.getCustomerRemarks()%>

should be:

<textarea name="customer_remarks" rows="3" cols="30"
<%if (repair.getCustomerRemarks()==null) %>onFocus=""<%else%><%=repair.getCustomerRemarks()%> >

or something like that...

ajkimoto

Na_Sait

8:57 pm on Mar 22, 2004 (gmt 0)

10+ Year Member



thanks for being there answering my questions. Actully, the code worked only when i changed it to the following format:

<TR><Td><FONT COLOR="#000080">Repair Details:</Font>
<TD><textarea name="repair_details" rows="3" cols="30">
<%if(repair.getRepairDetails()==null){ out.print("");}else{out.print(repair.getRepairDetails());}%></textarea>

Thanks again!