Real Time Data As Per Selection

frappe.ui.form.on("Draft", {
  lots: function(frm){
    // code
    set_value_message(frm);
  },
  action: function(frm){
    // code
    set_value_message(frm);
  }
});

var set_value_message = function(frm){
  var message = (frm.doc.action || "") + " " + (frm.doc.lots || "");
  frm.set_value("your_message", message);
}

Every time you leave textbox lots and action, it will set value to your_message.

Thanks, Got some hints from this one

I am trying to put an if condition in a html field and then print the message as accordingly to my message box.
Here’s the image of my field:

Here’s the code

var option_val=[];
frappe.ui.from.on("Draft",{

	option_value: function(frm){
if (document.getElementById('call').checked) {
   option_val="ABC";
} else {
  option_val="DEF";
}​
	set_value_message(frm);
}
});
var set_value_message = function(frm){
  var message = ( option_val || "")
frm.set_value("your_message", message);
}

I am unable to reach to the value of radio button’s value of html field. What am I doing wrong ?

even on

option_value: funtion(frm) {
alert('q');
}

Its no getting inside the option_value field. Any help will be appreciated

I can’t get radio button worked. Once I clicked it’s checked and unchecked automatically.

Why don’t you use Select Option instead of radio button?

Any way to do it via interpolation. Like if i type abc if field 1 then same automatically get typed in field 2 (without switching tab or anywhere else, ie remaining on same field) ??

I think no builtin frappe method for that. Use jquery keyup to accomplish what you want.

Through Interpolation in custom script ?

yes jQuery is available in frappe. you can run any jQuery method inside custom script

trying something like this to test:

$(document).ready(function () {
    $(cur_frm.doc.name1).on('change', function (e) {
       $(cur_frm.doc.name_2).val($(cur_frm.doc.name1).val());
    });
});

Trying to get content in name 2 field as i type in name 1.
Any help ?

change method does not fire as you are typing.

Try,
https://api.jquery.com/keyup/

$(document).ready(function () {
$(cur_frm.doc.name1).keypress(function() {
       $(cur_frm.doc.name_2).val($(cur_frm.doc.name1).val());
    });
});

NO Progress. Need Some serious help

$(`cur_frm.doc.name1`).keypress(function() {
  console.log( "Handler for .keypress() called." );
});

trying just a single field. Any hint for what should be there in place of cur_frm.doc.name1 (name1 is the field of name)

try something like below,
$(‘[data-fieldname=“name1”]’).keypress(function() {
console.log( “Handler for .keypress() called.” );
});

yeah already figured that one but i’m having difficulty in writing content to other field at same time.

Any help ??

$(`[data-fieldname='name1']`).keypress(function() {

var z= $(`[data-fieldname='name_2']`).val(this.val);
console.log(z);