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

reg: URL in Vf Page



  when we are clicking on new button in VF page there is one URL, but  when i'm tring to save that record but forget to enter one required field so it's showing error "you must enter value".. But the URL here is different.. but i want to maintain the same URL here because i'm having the condition depends on URL for save..

how to achieve that?



if you are using custom save code then you can handle from your controller ...when ever insert is failed you can create a redirect url using page reference object 


in that page when insert fails, there will be validation error.. so if we give the page redirect for URL how will we get that error in that page?

Abhay AroraAbhay Arora

 if there is an error set the RETURN NULL in your pagereference function


Please mark as solved if above is what you need



yes, but if we give return null then the URL is different, i want the same URL as that when we click on new button

Abhay AroraAbhay Arora

try using pageref.setredirect(false)