Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Pages - Design & Build
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:
  • Bassey Profile Picture
    2 on at
    Unable to Redirect Form
     
    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.
  • Suggested answer
    oliver.rodrigues Profile Picture
    9,175 Most Valuable Professional on at
    Unable to Redirect Form
    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

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

Thomas Rice – Community Spotlight

We are honored to recognize Thomas Rice as our March 2025 Community…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,508 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,440 Most Valuable Professional

Leaderboard

Featured topics