Help with label and javascript

Hi everyone, I need another little help. I am writing my own custom JavaScript code to insert into my custom form, always knowing you can read the data entered in the relevant Form Label via Javascript so as to perform various operations in my code. I’ve read about the developer guide before but it didn’t help much. I await your reply thanks in advance!

Hi,
sorry, I have trouble understanding your issue, what is it exactly you’re trying to do?

Through javascript I need to read the values ​​entered by users in the form. So after reading the values ​​I can always perform the operations I need through my javascript code.
For example users in the “To” field enter “100” and I need to read that value as well as all other values. I hope I explained myself.

@Crazy_El3ctr0

You can load your javascript using array include. It’s working for edit form to. Look at documentation:

I have integrated it, but my problem is not this is how can I read the data entered by users via javascript?

@Crazy_El3ctr0

Example for field description

  • for clean javascript: document.getElementById('description').value;
  • for jquery library: $('#description').val();

Did you search that?

In this way I can take the values ​​that are inserted in the modules?
I would need to know the values ​​that the user enters when creating a new offer (I’m referring to my case), so I don’t understand where I should get them I think from the php file?

regarding: $('#description').val();
this would return the actual value that the user entered in the current description field, like so:

For javascript, how should you do it? i followed suitecrm’s guide but I am not having great results.

I try to make myself understood better. I have created my own custom form. Now to do certain calculations I need to create my javascript file and I need to read the data that users enter and then print the result in a form field. Now I’ll give you an example so maybe it’s clearer, the user inserts “A = 100” then inserts “B = 10” I need to read these two data and then print in “C = 10” all this I should do in javascript but I don’t understand how to read the data from suitecrm and then print it back to screen. I hope it has now been clearer in that case just ask and I will provide you with everything you need! Thanks in advance

@Crazy_El3ctr0

I think that understand you. You should use ajax for call entryPoint of SuiteCRM. Look at the documentation for start:

Thanks now I’ll read the guide, try and let you know if it worked

Hi I have read the guide but I don’t understand how entry points can help me in what I need. Could you please explain me better?

I created a small jsfiddle for you, that is basically what I’ve tried to explain earlier:

https://jsfiddle.net/ncpf36mg/11/ -> add something in the first two fields and the concatenation is shown in the third field.

this shows how you can add a listener to some fields and insert a calculated value back to the UI, the same code works when you use proper Suite-IDs instead.

E: btw, if you’re not familiar with JS/Jquery, also test the same fiddle with
$('#output').val(parseInt($('#f1_input').val()) + parseInt($('#f2_input').val()));
instead :wink:

1 Like

Now I try and let you know even if I warn you I am not very familiar with suitecrm. Thank for your help!

A question how do I find the appropriate suite IDs? Thank you very much for your help if you can give me a detailed path on how to get the data from the suite module via javascript and then how to work with it I would be very grateful!

Right click in a field and select “inspect”. Within the HTML area you should see the field definition and its id (I’m currently on a mobile, but I can provide Screenshots tomorrow). But usually, the technical field name that you can see in the studio equals the id.

Thanks I understand. Do I have to integrate the javascript code in the edit view to ensure that once users have entered the data they see the calculations appear in the appropriate boxes?

Yes, and you can test your script in your browser console first.

I can’t figure out how to call the data in my javascript file. Just enter the IDs or do I have to make a specific call?

can you show us what you got so far?