How can we Split a Field?
Is there a way to Split Field WPForms Input to Hidden Fields?
Field Name: TMK
Mask 9-9-9-999-999-9999
TEXT EXAMPLE 1-2-3-444-555-6666
How to split and populate Hidden Field
ie.
Field = TMK
Hidden Field "Div" = “First Number” (1)
Hidden Field "Zone" = “Second Number” (2)
Hidden Field "Sec" = “Third Number” (3)
Hidden Field "Plat" = “Fourth Numbers” (444)
Hidden Field "Par" = “Fifth Numbers” (555)
Hidden Field "CPR" = “Sixth Numbers” (6666)
Related
I have a user sign up page and I want to create a "display name" from the users First and Last name.
If I have two text inputs, how can I create a string (and input that as the value of a hidden form field) that is the first name + last name abbreviation?
For example:
form input 1: Steve
form input 2: Jobs
hidden form input 3: Steve J.
var firstName = $("#cc-first-name").val
var lastName = $("#cc-last-name").val();
var lastNameAbbrev = lastName.charAt(0);
var hiddenDisplayName = firstName + " " lastNameAbbrev + ".";
$("#cc-hidden-display-name").val(hiddenDisplayName)
Is this right?
This question already has answers here:
How to auto change one input field value by changing another field value using JS
(2 answers)
Closed last year.
Two input fields total_bill & delivery_charge_bill.
total_bill field already have a value, now I want that when I input some value into delivery_charge field that will change the total_bill field's value.
Suppose total_bill field's value is 200.
Now I input 20 into delivery_charge field and that will effect the total_bill field and the value will be 220.
For any type of changes of delivery_charge field it will change the value of total_bill field.
But for myself it will not change perfectly.
Suppose total_bill is 200
when input delivery_charge = 2
total_bill = 202
when input delivery_charge = 20
total_bill = 2020
Here is my code detail
html
<h4>Grand Total : <input type="number" id="total_bill" readonly class="form-control total_amount" value="0.00"></h4>
<input type="text" name="delivery_charge" id="delivery_charge" class="form-control">
js
$('#delivery_charge').keyup(function(event) {
var total_amount = $('.total_amount').val();
var delivery_charge = $(this).val();
var grand_total_amount = total_amount + delivery_charge;
$('.total_amount').val(grand_total_amount);
});
Anybody help please? Thanks in advance.
If you use change event then it can be solved easily.
$('#delivery_charge').on('change',function() {
var total_amount = parseFloat($('.total_amount').val());
var delivery_charge = parseFloat($(this).val());
var grand_total_amount = parseFloat(total_amount + delivery_charge).toFixed(2);
$('.total_amount').val(grand_total_amount);
});
I have created one IMS System in that i have to do conversion of net_amount from number format to word format.I am getting proper output but it is in div element now i have to pass into input type text and after that i have to enter this value in database also.If anybody has any idea how to do it please help.
Below i have given my code (in this i am able to convert from div element to input type text box when i click on div value but value of input type is not entering in database)
<div class="col-md-12">
<p class="words"><b>Total Net Amount(In Words):-</b></p>
<div id="container" class="conversion"></div><input type="hidden" name="net_amount_words" id="net_amount_words_Hidden"/>
</div>
<script type="text/javascript">
$("#container").click(function(){
//check if there are any existing input elements
if ($(this).children('input').length == 0){
$("#saveFirstName").css("display", "inline");
//variable that contains input HTML to replace
var inputbox = "<input type='text' class='inputbox' name='net_amount_words' value=\""+$(this).text()+"\">";
//insert the HTML intp the div
$(this).html(inputbox);
//automatically give focus to the input box
//$("this .inputbox").focus();
//maintain the input when it changes back to a div
$("this .inputbox").blur(function(){
var value = $(this).val();
$("#net_amount_words_Hidden").val(value);
});
}
});
</script>
Below is my query to insert data into database
if(isset($_POST['submit'])){
$net_amount_words = $_POST['net_amount_words'];
$sql = "INSERT INTO `orders` SET `net_amount_words`='$net_amount_words' ";
$_dbConn->insert($sql) or die(mysql_error());
}
I'm working in yii2. In a form, I have a bootstrap modal and modal further contain a form. Modal's form have dynamically input fields. I want all these inputs fields values to store into hidden input field to use in php code after whole form submits.
Currently i'm taking modal's form input in this way.
var values = [];
$.each($('#modal :input').serializeArray(), function(i, field) {
values[field.name] = field.value;
});
and then
$('<input>').attr({
type: 'hidden',
value: values,
name: 'testvalue['+ testgrpid +']'
}).appendTo('form#reportform');
But this code is not working fine.
here 2 is testgrpid ...
currently i'm having this output in post in controller
[testvalue] => Array
(
[2] =>[]
)
but i want this type
[testvalue] => Array
(
[2] =>[input name] [input value]
)
please help me i'm stuck here.
I need some help in jQuery generated dynamic table rows with input fields and select option.
I want when I select option js input field id fee-2 will disable and when I select option php input field id fee-1 will disable and so on more rows inserted for
different from select option on different rows. at last need some of all rows inserted by field id fee-1
example is in image
My fiddle demo is here
http://fiddle.jshell.net/softfiddle/cSbbK/2/
Thanks
Change your HTML to:
<td><input type="text" id="fee-1" class="fee" name="js-fee"></td>
<td><input type="text" id="fee-2" class="fee" name="php-fee"></td>
Then use this Javascript:
$("#mytable").on("change", "select", function() {
var feeid = "#fee-" + $(this).val(); // Get ID of DIV related to selected item
$(".fee").prop('disabled', true); // Disable all the other DIVs
$(feeid).prop('disabled', false); // Enable the related DIV
// Now calculate the total
var total = 0;
$(".fee").each(function() {
total += parseInt($(this).text(), 10);
});
// And display it somewhere
$("#totaldiv").text(total);
});