Default value textfield - Post ID 252177

User 2625913 Photo


Registered User
10 posts

I've got a form to order something.
People have to submit their name, adress, zipcode and city as billing adress to order.
In case the want to have it shipped to another adress, they can additionally submit that data on the same form.
In the reply I want to tell them where the package is going to be sent to.
So the already filled in billingadress should be the default value for the shippingadress.

I've tried value="<? echo $_GET['Adres']; ?>", but it didn't do the trick... :(

How do I get that to work?

User 187934 Photo


Senior Advisor
20,271 posts

Where do you want to tell them this? On the confirmation page after the submit?
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2625913 Photo


Registered User
10 posts

Hi Eric,
For the customers to see and to be able to control immediately what the shippingadress is, I'd like to see it directly on the form as a default value, so in case the adress has to be altered they can do that on the spot.
Ergo: as soon as the billingadres is filled, I'd like to see that adress as default value for the shippingadress.
User 187934 Photo


Senior Advisor
20,271 posts

Ok, Ill get back to this in a bit as I have some choirs to do.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2625913 Photo


Registered User
10 posts

I've got it sorted out. :D
I build in a checkbox so customers can check whether the billing and shippingadress are te same.
At the formtag in HTML I added a name: name="form_12885302469"
At the checkboxtag I added: onclick="copy_address();"

And below the </form> tag I have added:
<script type="text/javascript">

function copy_address()
{
if(document.form_12885302469.item271_0_checkbox.checked== true){
document.form_12885302469.item266_text_1.value=document.form_12885302469.item9_text_1.value;
document.form_12885302469.item267_text_1.value=document.form_12885302469.item259_text_1.value;
document.form_12885302469.item269_text_1.value=document.form_12885302469.item1_text_1.value;
document.form_12885302469.item268_text_1.value=document.form_12885302469.item258_text_1.value;

}else{
document.form_12885302469.item266_text_1.value="";
document.form_12885302469.item267_text_1.value="";
document.form_12885302469.item269_text_1.value="";
document.form_12885302469.item268_text_1.value="";

}
}

</script>

Bear in mind to use the ID numbers of elements, rather than de Name tags.

Check the results at http://www.karinavandreemel.nl/Orderform_exported/Orderform/Orderform.html

User 187934 Photo


Senior Advisor
20,271 posts

Nice job figuring that out on your own.:cool:
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2625913 Photo


Registered User
10 posts

Thanks Eric!
The most difficult thing is to choose the right language..... is php, html, javascript.
As they say in Holland:"All roads lead to Rome" in other words, the job can be done in many different ways.
And the point is if it works, it's OK.

I posted the solution to help others finding their way in the maze! :D


Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.