• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP+Javascript doubt  RSS feed

 
satheesh krishnaswamy
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everybody,
I am very new to JSP and JAVASCRIPT.my query is I have to create a table dynamically based on the database and no of check box accordingly all in different rows.The table heading is fixed.(i,e column).Now that only if I select one check box then in that row the text box should appear otherwise,it should disappear.then after entering value in the text box and click the submit button then the whole row should be entered in the Database.I am using SQL SERVER.Kindly help me as soon as possible,since the matter is very urgent.I have to complete the project and only due to this I am strucked with.
Thanks in advance.
With Regards
Satheesh.K

[Bear: edited subject to remove shouting]
[ May 24, 2004: Message edited by: Bear Bibeault ]
 
Gert Cuppens
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't understand the following :

"Now that only if I select one check box then in that row the text box should appear otherwise,it should disappear.then after entering value in the text box"

How are you going to put a value in a text box that just disappeared ?

Furthermore, I'd use a radio button instead of a check box. If you want users to edit just one row, instead of multiple rows at a time, don't use a check box.
 
satheesh krishnaswamy
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear sir,
Sorry for not mentioning the problem properly.Actually What I mean is I can have multiple check boxes selected,and only for those check boxes that I select I should have the textbox in that row for one column.likewise,I can have any no of checkboxes selected and after selection all the fields will be readonly except the textbox field (i.e)column in which the user enter the value and if I click the submit button,the entire row should be inserted into the DB (by invoking EJB METHOD).
Kindly excuse me for the trouble and answer me as soon as possible.
The matter is most urgent.
 
Gert Cuppens
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry to answer you so late but I've given myself a few days of rest.
ABout your question, I must admit I've never done this kind of coding before. But as the matter seems interesting, I got a look around. And at java.sun.com I found the following answer to a question that is a lookalike of your own question :

GetParameterValues("name of checkbox") will return values of checked checkbox elements.

Example:
if you have following HTML-code:
<pre>
<input type="checkbox" name="foo" value="asd">
<input type="checkbox" name="foo" value="dsa">
</pre>
If only first one is checked GetParameterValues("foo") will return String[1] with String "asd". If both are checked you'll get String[2] with Strings "asd" and "dsa" and so on..


ABout the activation of a textfield as soon as you have the checkbox marked, there is a java solution : you should program an ActivationListener who takes care of this. But I'm sure you can find javascript solutions as well and I wonder whether these won't be found easier.
One example of a javascript solution can be found at http://forum.java.sun.com/thread.jsp?forum=33&thread=351903
 
satheesh krishnaswamy
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh Thank you very much sir,
I got the Result.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!