Jump to content

submitting only a particulat field whene there are many fiels in a form


bindiya

Recommended Posts

So you want the complete form to be submited even with empty fields automatically as a user writes in the field or when he changes a field?

 

Either way you need to use javascript to manipulate the data on the client side. 

document.yourform.submit()

or if you want to do server side functions use ajax to send it to php file where you will handle the form data.

 

Now to actually do the abaove you need to call a function either:

onkeyup='your_javascript_function()' or onblur='your_javascript_function()'

This would have to be like:

<input type='text' name='your_field' id='your_field' onblur='your_javascript_function()' />

or

<input type='text' name='your_field' id='your_field' onkeyup='your_javascript_function()' />

 

I hope this helps

Then on the first text field use the onblur like :

<input type='text' name='your_field' id='your_field' onblur='your_javascript_function(this.value)' />

were you see your_javascript_function(this.value) it's the function that will handle the data from that form

 

do i need to code this way

 

<form name='usercheck' method="post" action='useravailability.php'> <input name="username" type="text" id="username" value="" maxlength="15"  onblur='submit(this.value);'/></td><td width="185"></form>

well submit() is a reserved javascript function so its better to use another name for your function. like chk() for check. But yes that is the general idea. Also you need to have a function like

<script type="text/javascript">
function chk(username)
{
//do something here
}
</script>

in order to get the value and handle it the way you want within the function

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.