You need to sign in to do that
Don't have an account?

Apex code and Java Script Help
Hi Friends,
Trying to create a visualforce page to enter field values of one object. While we try to hit save it has to check if all fields are entered if not it has to open a window/page to display the missed fields and ask user to enter values there itself and save from that page/window.
I picked one object and 10 fields if 2 fields are not entered in the first page and user tries to hit save it has to open a window/page to show those two fields and user has to enter those fields in the second page/window and hit save. Then the record should be saved.
I wrote normal code which will save record when all fields are provided. Can Any one help me on this code!.
Thanks & Regards,
Trying to create a visualforce page to enter field values of one object. While we try to hit save it has to check if all fields are entered if not it has to open a window/page to display the missed fields and ask user to enter values there itself and save from that page/window.
I picked one object and 10 fields if 2 fields are not entered in the first page and user tries to hit save it has to open a window/page to show those two fields and user has to enter those fields in the second page/window and hit save. Then the record should be saved.
I wrote normal code which will save record when all fields are provided. Can Any one help me on this code!.
Thanks & Regards,
You can follow the below steps to achieve your requirement :
- Define a javascript method as CheckValues(field1,field2) on your page.
- Call this method onClick of Save Button and pass the id of your two fields in it.
- In your method CheckValues get the value of both fields with help of Ids that you have passed in the method.
- If both the fields are null than open a popup and where you will see both the fields.
- After entering the values in popup page store the entered values in two varibales and pass it tou JS method.
- Now from this JS method call a actionFunction and use two param attributes to assign the values to original fields.
- Call your save method form action function.
Let me know if you need any help on this.Thanks,
Abhishek
thank u so much for ur reply.. I am new to JavaScript with VF pages. Can you help me by giving some sample code for the above scenario..please don't mind.. Thanks!