We help IT Professionals succeed at work.

AJAX for extra input fields

birwin asked
Last Modified: 2012-08-14
I have a form that asks users to fill in the quantity of an item they have sold. The form has about 20 products, each with a text input field to enter the quantity. I now find that I also need to capture each item's serial number.

I would like to design the form so that if the user enters 4 as the quanity purchased, four text input fields appear below the original, to accept the serial number information.

I need the AJAX to show the appropriate input fields for the serial numbers and to allow server side verification of the serial numbers as they are entered.

My current input variables are arrays: e.g. <input type='text' name='prod[PC900]' value='' size='6'>

I would prefer the serial number be a compound array. e.g. prod_serial[PC900][1], prod_serial[PC900][2].

I am already using some AJAX on the page using Rafael Dohms brilliant autocomplete script for the company field, and I have used some other AJAX code on my site (although not on this page), but they have been modifiations of published scripts. I am not a Java/AJAX guru myself.  

I am using PHP for the server side.

I really appreciate your help.

Watch Question

Top Expert 2007
Unlock this solution and get a sample of our free trial.
(No credit card required)


I tried to set this up, but I am having trouble getting xajax to work. I have installed it, and I can get the examples to work and as far as I can determine, I am setting it up according to the examples, but I keep getting an error "Fatal error: Call to undefined method xajax::processRequests()"

Can you give me the full xajax code to make this work?

Also my site is templaed, so I need to be able to load the variable $display with any displayed output or $head for any code that appears in the head of the document.


I will gladly award more points, or if you are available freelance, I can hire you to complete the code for me.


Dear hernst42:

As luck would have it, my clent changed their mind and no longer want this option.

I'll still try hacking through xajax, since it seems to be a very useful program.

Thank you for your solution.

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.