function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Fire a javascript function from input field on a certain condition

Can you give some more details, are you trying in visualforce page ?

Hi Govind,

Actually I need to fire a java script function(In this function  --> I need to capture the value of Input field value) , on a condition.
there are two objects Project and Project Activity. Project activity is a child of Project.
I have overwritten the new button on Project Activity.
Now there are two ways activities can be created. 1.) From the Project Detail page{The code in this case is not working since the java script method is called on the ONChange method of the Input Field} --> In this scenario when I try to create a Project Activity, it aleady holda the Project value.
2) Is from thr Project Activity Tab--> New {In this scenario the code is working.. Since the java script function is called on the OnChange event}

Basically, when I try to create the Project Activity from the Project detail Page, it is throwing error, as the java script function to capture the value of the input field is written on the OnChange Event.
I need a work around for both the scenarios, where in I should be able to create the Activities from the Project detail page and from the Project Activity Tab also.
Please help me.


Hi bs881026, 

Am not sure I understand the whole use case, but it seems like you are trying to run a javascript function on change event of project lookup field. SInce you fill it manually when creating activity from Tab, your function is working, but from detail page, this feild is pre-populated, so your function is not being called... is that right ? 

If my understanding is correct, then your javascript is working, but since the field is not changing at all, the javascript is not being called. ?? 

Are you using salesforce standard detail page, or you have your own VF page to create activities ? 

It is a Vf page, which is overwritten on the New button of the Project Activity.