Passing value from URL to EDIT Form

Deronda created the topic: Passing value from URL to EDIT Form

Hi! I've followed several other posts regarding passing parameters...but I'm missing something.

I have a URL such as: dev.website.org/surname-edit/?snid=1

I've created an UPDATE form where I want all the fields populated based on the SNID in the URL. The SNID I want hidden. Typically, I would use a php statement in the WHERE clause, but that's not working. WHERE snid= '<?php $_GET[snid] ?>'

HELP! I've been working on this all day, and I'm brain dead now. I know it has to be something simple.

#91201

Please Log in or Create an account to join the conversation.


Anoush replied the topic: Passing value from URL to EDIT Form

Hello Deronda,

Thanks for getting to us!

So you want that after submitting the form the information (which is sent to the administrator) also included the page url, is it ?

Thanks and have a nice day!

#91215

Please Log in or Create an account to join the conversation.


Deronda replied the topic: Passing value from URL to EDIT Form

Hi! I have another page that has a list of surnames. In that report, contains a hyperlink with the parameter. So, I'd want the information pulled when the form is first opened.
SELECT CONCAT('<a href=surname-edit/?snid=', snid,' >', 'Edit','</a>') as 'EDIT', surname as 'Surname' from website.tgs_surnames ORDER BY surname

So, the person views this report first, clicks on the EDIT link then will open this new FORM to edit/update the information. Then I'll have them return back to the report with the updated information...hopefully.

#91231

Please Log in or Create an account to join the conversation.


Deronda replied the topic: Passing value from URL to EDIT Form

This is the code I'm trying out, but I'm thinking there's something that needs to be added in the field value? in the SQL Mapping, I've tried PHP code, simple GET statement and just linking to the SQL field {18}. But nothing populates in the form...Value is always "".

function before_load() {
function getParameterByName(name, url) {
if (!url) {
url = window.location.href;
}
name = name.replace(/[[]]/g, "$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/+/g, " "));
}
jQuery("#wdform_18_element10").val(getParameterByName("snid"));
jQuery("#wdform_18_element10").attr("class", "input_active");


window.onload=function(){
document.getElementById('snid').value = '2';
}

#91239

Please Log in or Create an account to join the conversation.


Anoush replied the topic: Passing value from URL to EDIT Form

Hello Deronda,

Could you please also share the link where you have published the form?

Thanks!

#91299

Please Log in or Create an account to join the conversation.


Deronda replied the topic: Passing value from URL to EDIT Form

Sure! I can see that the form recognizes the URL, but now trying to figure out how to populate the fields based on that record. Example: snid=2.

This is the first page where folks will click on edit to what I hope will edit content. dev.tulsagenealogy.org/surname-testmemberlist

#91309

Please Log in or Create an account to join the conversation.


Anoush replied the topic: Passing value from URL to EDIT Form

Dear Deronda,

You have done all correctly. Only please instead of this return decodeURIComponent(results[2].replace(/+/g, " ")); add this one return decodeURIComponent(results[2].replace('/+/g', " "));

Thanks and have a great day!

#91333

Please Log in or Create an account to join the conversation.


Deronda replied the topic: Passing value from URL to EDIT Form

Thank you!!!!! That piece of the puzzle worked.

#91337

Please Log in or Create an account to join the conversation.


Anoush replied the topic: Passing value from URL to EDIT Form

Dear Deronda,

Great :) it is very nice to hear!

Is there any chance you could share your experience on review page here.

Thanks and have a wonderful day!

#91339

Please Log in or Create an account to join the conversation.


Time to create page: 0.215 seconds
Powered by Kunena Forum

WORLD-CLASS SUPPORT

We are here for you every step of the way. Turn to our support with any questions you might have about our products and services. Our experienced customer care team is available to help you as fast as we possibly can.

Contact us