Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Problem in creating dynamic form...also, is it possible to add the fields from JAVASCRIPT directly to the database using JSP?...

Reply
Thread Tools

Problem in creating dynamic form...also, is it possible to add the fields from JAVASCRIPT directly to the database using JSP?...

 
 
Jagdeesh
Guest
Posts: n/a
 
      09-26-2003
Hello everyone,

I am using JSP with javascript for my application. I am a new user of
this field. I am creating a dynamic project entry form as written
below. I have a button named "ADD MORE PROJECT DETAILS". When i click
that button, it must create another project column(projectname2 and
status2). When again clicked it must create another
column(projectname3 and status3) and so on, without interrupting the
previous project columns.

I have written a script for that, but unfortunately the column is
being overwritten when i click the ADD MORE PROJECT DETAILS button.
Pls. take a look of my file and tell me whats wrong or what must be
used. Also, tell me whether i can add all these details from the
javascript to the database(POSTGRESQL) as in the case of JSP.

MY JSP FILE:

//.................blah blah blah...................

out.print("<tr>\n <td>Project Name 1</td><td style=\" border-width:
1\">");
out.print("<textarea name=\"projectname\" cols=\"70\"
rows=\"2\"></textarea>");
out.println("</td>\n </tr>");

out.print(" <tr>\n<td>Project Status 1</td><td style=\"border-width:
1\">");
out.print("<textarea name=\"status1\" cols=\"70\"
rows=\"2\"></textarea> ");
out.println("</td>\n </tr>");

// ................Additional fields ..........

out.print("<tr><td style=\"text-align: Center; colspan=\"2\"><input
type=\"button\" value=\"Add more Project details\"
onClick=\"javascript:addmore();\"></td>\n </tr>");

out.print("<tr><td>");
out.print("<span id=cust1 style=\"position:relative;\"></span>");
out.println("</td>\n </tr>");

out.print("<tr><td>");
out.print("<span id=cust2 style=\"position:relative;\"></span>");
out.println("</td>\n </tr>");

// ........then i have the SUBMIT BUTTON ........


MY JAVASCRIPT IS:

<script Language="JavaScript">

var num=1;
function addmore() {

num++;

data1 = "<font style='font-size: 11pt; color:
#00000'>Projectname"+num+"</font>";
data2 = "<textarea name='projectname"+num+"' cols='70'
rows='2'></textarea>";
data3 = "<font style='font-size: 11pt; color: #00000'>ProjectStatus
"+num+"</font>";
data4 = "<textarea name='status"+num+"' cols='70'
rows='2'></textarea>";

cust1.innerHTML = data1;
cust2.innerHTML = data2;
cust3.innerHTML = data3;
cust4.innerHTML = data4;
}
</script>


It would be great if you can suggest your views as soon as possible..

Thanx for spending your valuable time.

Cheers,
Jagdeesh.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DataBase DataBase DataBase DataBase scott93727@gmail.com Computer Information 0 09-26-2012 09:40 AM
epydoc: How to add new fields as the building fields? Cyril.Liu Python 0 12-02-2008 05:01 AM
possible to allow a user to type directly into a dropdown list to add new item? Dica ASP .Net 4 11-09-2005 02:43 PM
Preview image directly on PC, save directly to HD Patrick M. Digital Photography 3 01-07-2004 08:29 PM
Problem in creating dynamic form...also, is it possible to add the fields from JAVASCRIPT directly to the database using JSP?... Jagdeesh Java 2 09-28-2003 03:10 PM



Advertisments