Taking values from a form without sending it...

This is a discussion on "Taking values from a form without sending it..." within the JavaScript Forum section. This forum, and the thread "Taking values from a form without sending it... are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Jan 8th, 2008, 17:15
New Member
Join Date: Jan 2008
Location: On the moon
Age: 35
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Taking values from a form without sending it...

Hi there everyone !
I'm new at Js, so don't be cruel...
I have a big form and in certain part of it a link that makes a hidden layer to become visible with an aditional and independent small form that takes some values from the half filled big form into hidden fields...
Code: Select all
 
<table>
<tr><td>
<input name="street" id="street" size="30" maxlength="100" />
</td><tr>
<tr><td>
<input name="city" id="city" size="30" maxlength="100" />
</td></tr>
</table>
Next to this point there's a link to show a hidden layer which contains the small form:
Code: Select all
<a href="#" onClick="showmenow('formurba','visible')">Extra details</a>
This link invokes following function:


Code: Select all
function showmenow(object,val) { 
document.getElementById(object).style.visibility = val; 
var local = document.getElementById("SubCat");
var street = document.getElementById("street");
var city = document.getElementById("city");
street2.value = street.value;
    city2.value = city.value;
}
After this, I try to show the values in the just appeared layer, but nothing happens, document.write, doesn't work and hidden fields don't get filled...
Code: Select all
<div id="formurba">
<SCRIPT Language="JavaScript">
document.write("Street name :" + street + "Cuty name : " + city)
</SCRIPT>
<input type="hidden" name="street2" id="street2" value="">
<input type="hidden" name="city2" id="city2" value="">
</div>
I don't even get the "Street name :" string, only if I remove the var from the document.write line...
Why??

Last edited by Mazinger; Jan 8th, 2008 at 18:12. Reason: It was a mistake using the code tags
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Jan 8th, 2008, 17:29
alexgeek's Avatar
Moderator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,812
Blog Entries: 9
Thanks: 2
Thanked 2 Times in 2 Posts
Re: Taking values from a form without sending it...

Why not try this somewhere:
Code: Select all
document.getElementById("formurba").innerHTML = "Street name :" + street + "Cuty name : " + city;
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Jan 8th, 2008, 18:10
New Member
Join Date: Jan 2008
Location: On the moon
Age: 35
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Taking values from a form without sending it...

What will this cause and where should i place it, I'm a little lost...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Jan 8th, 2008, 18:16
alexgeek's Avatar
Moderator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,812
Blog Entries: 9
Thanks: 2
Thanked 2 Times in 2 Posts
Re: Taking values from a form without sending it...

This may work:
Code: Select all
function showmenow(object,val) { 
document.getElementById(object).style.visibility = val; 
var local = document.getElementById("SubCat");
var street = document.getElementById("street");
var city = document.getElementById("city");
street2.value = street.value;
    city2.value = city.value;
var h = document.getElementById("formurba").innerHTML;
h = "Street name :" + street + "Cuty name : " + city + h; }
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Jan 8th, 2008, 18:39
New Member
Join Date: Jan 2008
Location: On the moon
Age: 35
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Taking values from a form without sending it...

Nothing happens, nothing gets written, no content fills the hidden fields...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting Form Values to Previously Entered Values masonbarge PHP Forum 6 Oct 17th, 2006 17:36
Sending Form to E-mail student_in_training JavaScript Forum 2 Aug 16th, 2006 12:41
form not updating values djanim8 Classic ASP 0 Dec 10th, 2005 19:05
Multiple Choice Form Values Andy K PHP Forum 9 Aug 30th, 2005 12:01
Passing values from Datagrid to another form caryma ASP.NET Forum 4 Aug 17th, 2005 08:06


All times are GMT. The time now is 01:24.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42