Lengkap

Add SELECT TAG to function with "Dynamic INPUT fields to auto submit all to mysql" jQuery

This is an easy 15 min. work to make little extra income for java jquery expert.

Below is a script for automatically submitting forms to a MySQL database, but it doesn't work for <select> tags. How can I make this script work for those as well?

I have been struggling to include values from

<SELECT id="group1" name="group1">has over 100 options</select>

<SELECT id="group2" name="group2">has over 100 options</select>

along with other input fields to autosubmit as following

//script start

<script type="text/javascript">

// JQUERY: Plugin "autoSumbit"

(function($) {

[url removed, login to view] = function(options) {

return [url removed, login to view](this, function() {

// VARIABLES: Input-specific

var input = jQuery(this);

var column = [url removed, login to view]('name');

// VARIABLES: Form-specific

var form = [url removed, login to view]('form');

var method = [url removed, login to view]('method');

var action = [url removed, login to view]('action');

// VARIABLES: Where to update in database

var where_val = [url removed, login to view]('#where').val();

var where_col = [url removed, login to view]('#where').attr('name');

// ONBLUR: Dynamic value send through Ajax

[url removed, login to view]('blur', function(event) {

// Get latest value

var value = [url removed, login to view]();

if ([url removed, login to view]('type') == "checkbox")

{

if ([url removed, login to view]('checked') ){

value = 1;

}else{

value = 0;

}

}

// AJAX: Send values

[url removed, login to view]({

url: action,

type: method,

data: {

val: value,

col: column,

w_col: where_col,

w_val: where_val

},

cache: false,

timeout: 10000,

success: function(data) {

// Alert if update failed

if (data) {

alert(data);

}

// Load output into a P

else {

jQuery('#notice').text('Updated');

jQuery('#notice').fadeOut().fadeIn();

}

}

});

// Prevent normal submission of form

return false;

})

});

}

})(jQuery);

// JQUERY: Run .autoSubmit() on all INPUT fields within form

jQuery(function(){

jQuery('#ajax-form INPUT').autoSubmit();

});

</script>

<form id="ajax-form" class="autosubmit" method="POST" action="[url removed, login to view]">

<fieldset>

<div>

<div><input name="date" value="'.$Row['date'].'" /></div>

<div><input name="job" value="'.$Row['job'].'" /></div>

<div><input name="numb" value="'.$Row['numb'].'" /></div>

<div><input name="ri_amount" value="'.number_format($Row['ri_amount']).'" /></div>

<div><input name="ri_code" value="'.$Row['ri_code'].'" />

<div id="ri_codemenu">

<select id="group1" name="group1">

<option value="112" '. ((in_array('112', $ricode_array)) ? 'selected' : '').'>value1</option>

<option value="113" '. ((in_array('113', $ricode_array)) ? 'selected' : '').'>value2</option>

<option value="114" '. ((in_array('114', $ricode_array)) ? 'selected' : '').'>value3</option>

</select>

</div>

<div class="payamount"><input name="shi_amount" value="'.number_format($Row['shi_amount']).'" /></div>

<div class="shicode"><input name="shi_code" value="'.$Row['shi_code'].'" />

<div id="shi_codemenu">

<select id="group2" name="group2">

<option value="112" '. ((in_array('112', $shicode_array)) ? 'selected' : '').'>value1</option>

<option value="113" '. ((in_array('113', $shicode_array)) ? 'selected' : '').'>value2</option>

<option value="114" '. ((in_array('114', $shicode_array)) ? 'selected' : '').'>value3</option>

</select>

</div>

</div>

<div class="paytax"><input name="tax" value="'.$Row['tax'].'" /></div>

<div id="donebox"><input id="done'.$bi.'" type="checkbox" name="done" value="'.$Row['done'].'" '. ((in_array('1', $done_array)) ? 'checked' : '').'/><!--<label for="done'.$bi.'"></label>-->

</div>

<input id="where" type="hidden" name="id" value="'.$Row['id'].'" />

</fieldset>

</form>

// script end

//[url removed, login to view]

function clean($value){

return mysql_real_escape_string($value);

}

/* * FORM PARSING*/

// FORM: Variables were posted

if (count($_POST)){

// Prepare form variables for database

foreach($_POST as $column => $value)

${$column} = clean($value);

// Perform MySQL UPDATE

$result = mysql_query("UPDATE accountant SET ".$col."='".$val."'

WHERE ".$w_col."='".$w_val."'")

or die ('Unable to update row.');

}

Kemahiran: AJAX, HTML, Javascript, jQuery / Prototaip, PHP

Lihat lagi: where to get an accountant, where to find java, where can i get javascript, where can i get an accountant, unable to find a job, type of accountant, this class jquery, parsing input, latest jquery, jquery include, jquery class, include jquery, how to get in an accountant, how to get a value in javascript, get accountant, find accountant job, dynamic p, dynamic cache, auto alert, attr php

Tentang Majikan:
( 11 ulasan ) Bunkyoku, Japan

ID Projek: #10115644

Dianugerahkan kepada:

lightning1vw

Hi, I think I have solution for your problem. Try add this one line "jQuery("#ajax-form SELECT").autoSubmit();" on your code like on example below. // JQUERY: Run .autoSubmit() on all INPUT fields within form j Lagi

$15 USD dalam 0 hari
(6 Ulasan)
3.1

12 pekerja bebas membida secara purata $27 untuk pekerjaan ini

rajeshsonisl

Hello! With 98% to 99% completion rate, 900+ successfully completed projects, and a 4.99 reputation (maximum possible, 5.0) (can be verified on my profile page https://www.freelancer.com/u/rajeshsonisl.html !!)... y Lagi

$64 USD dalam sehari
(740 Ulasan)
7.9
acer2004sl

Hello It can be fixed right now Let me know if you are interested. Thank you ============================================

$45 USD dalam sehari
(285 Ulasan)
6.9
mondersky

Hello, is this code a snippet taken from a php string? I wont be able to run it correctly on my localhost, the best would be to send me the whole files in a rar file or letting me access the files on your own server ot Lagi

$20 USD dalam sehari
(141 Ulasan)
6.6
duykhanhonline

I have great experiences on this kind of [login to view URL] if have a chance to work with you on this project. I can work directly via Teamview. Best regards.

$30 USD dalam sehari
(47 Ulasan)
5.3
imranahsan1

We have read your project description and it is honor for us to do you [login to view URL] can get quality work from us regarding this project.

$15 USD dalam sehari
(61 Ulasan)
5.4
sumanrajpura

A proposal has not yet been provided

$25 USD dalam sehari
(5 Ulasan)
2.7
shaochao555

Hello. Welcome to your proposal. I am a MySQL, PHP, Javascript expert. I completed the many web development projects in the past and I have a lot of experience in them.= I assure high quality about your task. Thank Lagi

$30 USD dalam sehari
(4 Ulasan)
2.3
itdev15

Hi sir Thank you for your post. I am really interested to work in your project. I have 10 years experience in web development. I have gained enough experiences in web design, javascript, PHP and MYSQL. High Qualit Lagi

$25 USD dalam sehari
(2 Ulasan)
0.8
waqas8342

Hi! Willing to perform your task aggressively as per your requirement. Lets talk to complete it. Hope you will have nice time from me. Thanks ============================== ▌│█║▌║▌║ ║▌║▌║█│▌▌================= Lagi

$10 USD dalam sehari
(2 Ulasan)
0.5
metasoft7

Dear Prospect Hiring Manager. Thank you for giving me a chance to bid on your project. i am a serious bidder here and i have already worked on a similar project before and can deliver as u have mentioned I have c Lagi

$25 USD dalam sehari
(0 Ulasan)
0.0
arifkpi

I have proven skill on HTML, CSS, CSS3, JavaScript, jQuery, PHP, MySQL etc. So it think i'm not the good but i'm one the best fit for this particular project.

$30 USD dalam sehari
(0 Ulasan)
0.0
geraldo007

A proposal has not yet been provided

$20 USD dalam sehari
(0 Ulasan)
0.0