Thread Starter
lotfus
(@lotfus)
Another way to see it is that I want to have feedbacks specific to the posts…
Is there any way to do it?
Dear lotfus,
Please create a hidden field on your form and name it, for example, Page Title. Afterwards go to Form Options > Custom Javascript and write the following code to before_submit() function:
document.getElementsById('field_id').value =document.title;
Please note, that you need to check the id of the hidden field and write it instead of field_id.
Thank you.
Thread Starter
lotfus
(@lotfus)
Hello webdorado,
thanks a lot for your answer.
I did as you described: now I see indeed in my “submission” section the column pageTitle. The problem is that the piece of code is not working. The form doesn’t submit anymore when I hit the submit button (no reaction).
Here is the code I inserted in before_submit():
// before form submit
function before_submit() {
document.getElementsById('wdform_4_elementform_id_temp').value =document.title;
}
And I tried to put a simple string instead just to test, but it still didn’t work:
document.getElementsById('wdform_4_elementform_id_temp').value ="Hello!";
Any idea what is going wrong?
Thanks a lot.
L.
Dear lotfus,
Please try writing the ID of your form instead of form_id_temp. For example, if your formβs ID is 5, the code will be:
function before_submit() {
document.getElementsById(‘wdform_4_element5’).value =document.title;
}
Thank you.
Thread Starter
lotfus
(@lotfus)
Hello again,
thanks a lot for your help. I have just tried, unfortunately it doesn’t work. My form id is 12, here is my code now:
// before form is load
function before_load() {
}
// before form submit
function before_submit() {
//var pageName = "Hello!";
document.getElementsById('wdform_4_element12').value =document.title;
}
// before form reset
function before_reset() {
}
But when I hit submit, there is no reaction.
Any other ideas π ?
Dear lotfus,
Could you please give us the link to the form page, where we could check the Javascript errors?
Thank you.
Thread Starter
lotfus
(@lotfus)
Actually I have a local ww.wp.xz.cn installation, nothing is online yet.
I installed firebug to check the javascript error, but it’s telling me: “Access to restricted URI denied.”
I am trying to figure it out.
If you have any other hints I am happy to hear. thanks.
Dear lotfus,
Please be informed, that the error is not related to Contact Form Maker. And if your website is not live, please send the source code(HTML) to [email protected], and we’ll check the errors.
Thank you.
Thread Starter
lotfus
(@lotfus)
Thanks a lot. I will send you an email.
Dear lotfus,
Please change getElementsById to getElementById. Sorry for the misspell. It should look like the following:
function before_submit() {
document.getElementById('wdform_4_element12').value =document.title;
}
And should work that way.
Thank you.
Thread Starter
lotfus
(@lotfus)
Wondreful! it works.
Thanks a lot. Once it is live I will let you know π
Best,
L.
Dear lotfus,
Please feel free to let us know in case you have other questions.
Thank you.