web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / Unable to Redirect Form
Power Pages
Suggested Answer

Unable to Redirect Form

(0) ShareShare
ReportReport
Posted on by 2
Hello everyone
 
I am a noob to Power Pages.
I have a Power Pages website I created without a web template.
 
I have a page with a basic form that the fields on it are read, there is also a button (Update KYC).
 
 
 
 
When the button is clicked on, I want it to redirect to open the edit form.  
I tried to add the javascript below:
 
<script>

  document.getElementById('updateContactButton').onclick = function(event) {

    event.preventDefault();
 
    var urlParams = new URLSearchParams(window.location.search);

    var recordId = urlParams.get('id');

    

    var editFormUrl = '/editcontact/?id=' + recordId;   

    window.location.href = editFormUrl;

  };

</script>
 
but it does not pick the ID of the record, hence I get the message that the record cannot be found. 
 
 


I'll appreciate any help I can get on this.
Categories:
I have the same question (0)
  • Suggested answer
    oliver.rodrigues Profile Picture
    9,368 Most Valuable Professional on at
    Hi, a couple things to check
     
    • can you pop-up as an alert the recordId variable to see if there is any value?
    • maybe do the same for urlsParams or add to the console so you can troubleshoot
    • so you have a read-only form, and then redirect to the edit version on the click of a button is that it? one option here is:
      • have the form as Edit Form
      • apply JS on page load that will change all fields to read-only
      • on the click of the Edit button
      • re-apply JS that will change all fields to editable
      • this way you wouldn't need to re-load the entire page
  • Bassey Profile Picture
    2 on at
     
    Yes, I have and I can see the ID of the record from the console.
     
    Let me try the second option of disabling the fields on load of the page and enabling after the button is clicked on.
     
    Please if you have an idea of how to go about it with javascript, I would appreciate it.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Pages

#1
Fubar Profile Picture

Fubar 78 Super User 2025 Season 2

#2
Jerry-IN Profile Picture

Jerry-IN 75

#3
sannavajjala87 Profile Picture

sannavajjala87 31

Last 30 days Overall leaderboard