submit form


#1

so I have a magnetic stripe scanner, I need the form to submit automatically when a certain number of characters is reached in the form field. any help?


#2

Use the ONCHANGE on the field and send it to a javascript function.
In the function, check the len(ofthefield) and whatever…


#3

So I have this:
[php]




*Card Number:
[/php]

the form submits via ajax. how do I make a pup up window that will display a text box that then is part of the form, but the form doesn’t submit until this textfield is filled in. how would I do this?


#4

Well, do you mean this line:

You already have a function in it that is called “onkeyup” which is name “fun”.
So, when a key is pressed in this input field and released, this code is called.
You can just add your pop-up in that function. Something like this would be needed:

if (card.card1.value.length value.length > 8) {
   // Whatever you want when this field reaches 8 chars...  (Change number to your limit)
   alert("Card1 is full!");    // This alert is just a sample... 
  }

NOTE: in Javascript the length is formatted: form_name.textfield_name.vlaue.length…
So, card.card1 is your form’s name and text field’s name…

Hope that helps…