You need to sign in to do that
Don't have an account?
Chubby
I want to render two fields based on change in single field with different conditions
Hi,
I have a multi select picklist field on vf page. I am rendering text field based on the value in multi picklist. Now i want to render other picklist field based on multipicklist value(with different condition). Since Iam already rendering one field i have written onchange event. now i cant use the same event and write another event for the same tag. How can I render two fields onchange of first field(two fields should be rendered with two conditions)? Please help me to achieve this scenario.
Thanks.
I have a multi select picklist field on vf page. I am rendering text field based on the value in multi picklist. Now i want to render other picklist field based on multipicklist value(with different condition). Since Iam already rendering one field i have written onchange event. now i cant use the same event and write another event for the same tag. How can I render two fields onchange of first field(two fields should be rendered with two conditions)? Please help me to achieve this scenario.
Thanks.
Please refer the below code.Hope this will help.
All Answers
This is achievable using single onchange event only. Create two separate Javascript functions for your requirement and call those two functions from the onchange event. you can call like onchange="function1(),function2()"
Thanks for your response. Is it achievable without javascript?
Use javascript .This is the best option. Please mark this as solved if the answer is helpful.
I am not familiar with scripting . could someone pls help me what to write in javascript and pass to controller method. I tried the below code but was stuck in javascript.
Please refer the below code.Hope this will help.
Thank you so much for your response!
In your code you are calling single event and javascript but in my case i need to write two javascipt functions and call both in single onchange event.
There is javascript written already to render the Field1. I need to render field 2 again Onchange of Account.customfield__c without breaking the existing Field1 render functionality. That is why i am finding difficulty. I tried different ways but nothing workedout.
Thanks.
This is actually simple. Refer the same code and in the input field add this onchange="function1(),inputStatus(this.value)" (I am considering function1 as your exsisting javascript code which is rending field 1 ).Please do the changes accordingly and let us know if this meeting your requirement.
I followed the way you suggested. In this case the Field1 also not redered. In my exiting code developer written onchange="function1(this.value);" If i am adding another function with comma separated like onchange="function1(this.value),inputStatus(this.value);" this breaking the functionality. I am not sure what the semicolon will do here.
If want to do with ; then use onchange="function1();function2();" .If after doing this function1 is not working but the second function is working that means some logic is missing for function1.Try this and let me know.
Thanks a lot for your help!
After many trials i am able to achieve it. Now I am not able to render the field until i valued all the mandatory fields present in the page, even using immediate=true in action function. Could you pls suggest on this?
Thanks.