473,396 Members | 1,726 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

making more textboxes on the same screen appear when a user clicks a button

I asked this question already, but I am not sure why it has been moved to the javascript forum? ARe you telling me that this cannot be done using php?

Thanks.
Jul 3 '07 #1
2 1018
kovik
1,044 Expert 1GB
I asked this question already, but I am not sure why it has been moved to the javascript forum? ARe you telling me that this cannot be done using php?

Thanks.
We're telling you that, in the sense that you are asking, no. If you want to do this upon form submission, then it can be done in PHP, however PHP is not a client-side programming language: It is processed ONCE per page load. So, to do this in PHP, you're page would need to be loaded again.
Jul 3 '07 #2
code green
1,726 Expert 1GB
Didn't see start of thread but this function will create the number of textboxes entered in the totBoxes text box.
You need to allocate a <div> called "boxes" in HTML.
Also needed is an onClick() function for your button.

Expand|Select|Wrap|Line Numbers
  1. function createTextBoxes()
  2. {               
  3.     var boxes = document.getElementById('totBoxes'); 
  4.     var noBoxes = boxes.value;         
  5.  
  6.     var mydiv = document.getElementById("boxes");
  7.  
  8.     var newHTML = '<br>Enter the data<table border="1" cellspacing="10">';
  9.     newHTML += '<tr><th>Data</th></tr>';       
  10.  
  11.     //Create textboxes          
  12.     for(var r=0;r<noBoxes;r++)
  13.     {
  14.         newHTML += '<tr>';
  15.         //alert('here');        
  16.  
  17.         var box = 'name="box' + r +'"';                   
  18.         newHTML += '<td>';    
  19.         newHTML += '<input type="text"'+ box +'/>';
  20.         newHTML += '</td></tr>';        
  21.     }
  22.     newHTML += '</table>';    
  23.     mydiv.innerHTML = newHTML;               
  24. }
They are laid out in a table. Probably not what your looking for but its a start
Jul 4 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: |-|erc | last post by:
Hi! Small challenge for you. The index.php uses this file and calls layout(). Take a look at www.chatty.net this file draws the chat login box on the right. I traced the CHAT button it submits...
3
by: RICHARD BROMBERG | last post by:
I am using ASP and CDONTS to read data entered into a Form and E-mail the data entered to me. The Form is pretty long and has about thirty Text entry boxes and some radio buttons. After the...
4
by: Jason M | last post by:
Hi, Im very new to c#, so forgive me if this is a really stupid question. Im trying to create a form for entering purchase requests. For each line item I have a quantity, a description unit cost...
3
by: Forconi Boris via .NET 247 | last post by:
Hi, I'm working on a project in witch I have to list data(products that can be selected with a certain quantity) from anXML document, with key words entered by the user. A Table isdynamically created...
4
by: Marlene A. Roman | last post by:
Is there a way that when I show some fields below that don't fit in the screen, it automatically makes a scroll down event so the user doesn't have to scroll down the page by his own? Thanks in...
2
by: Michael | last post by:
Need some help trying to read values from web controls - specifically *finding* the controls (like a drop down list) - that are added dynamically added within an asp:panel control. The page...
1
by: bigmaddaz | last post by:
Ok im designing an application for working out compount interest. The user starts the page, 3 prompts appear, one asking for money invested, next asking for rate of interest, and last one asking for...
4
by: =?Utf-8?B?QWxCcnVBbg==?= | last post by:
I have a form with some textboxes and a button. I'd like for the button to be disabled until the user enters valid data in either of two of the textboxes, but can't quite seem to figure out how to...
5
by: phpbeginner | last post by:
Hello again. My question is: Let's suppose that a user clicks on a button. When this button is pressed I want to have a few text boxes appear for the user to fill in. These fields must appear on...
5
by: Andy B | last post by:
I have 2 TextBoxes and an Add button on a page. When the user fills in the TextBoxes, the values are added to a dataset table. When the page gets done reloading, the TextBoxes are turned into...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.