 |
| Javascript General Javascript discussions. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

December 6th, 2004, 11:41 PM
|
|
Friend of Wrox
|
|
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
|
|
Can two forms share values within a function
Good day
Should I be able to do this?
function showCatsSubmit(catId,catName)
{
showCats.id.value = catId;
showCats.catName.value = catName;
showCats.submit();
showCats.eventTitle.value = createNewEvent.eventTitle.value
}
I have two forms on a page:
1..showCats
2..createNewEvent
My objective is to submit showCats, reload the page, then pass the value in showCats.eventTitle to createNewEvent.eventTitle
'ShowCats' is completely hidden. It is used to show a tree structure of items within a category, each with a checkbox for selection. 'createNewEvent' is seen on the page however when a category is selected ('ShowCats' is submitted) to show its tree items of course I loose the values any 'createNewEvent' form input fields.
mmmmmm, I havenât coded a page this way before but logically it seems like it should be possible. I get no error's, everything is defined, the submit function runs fine, the tree works fine. Should I be able to say? (line 6 of the function above):
showCats.eventTitle.value = createNewEvent.eventTitle.value
TYIA
Wind is your friend
Matt
__________________
Wind is your friend
Matt
|
|

December 7th, 2004, 12:39 AM
|
|
Friend of Wrox
|
|
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
|
|
Please dis regard the above post, missing semi colons was stopping it. I was under the impression that should have given me an error since I have told IE to give me script errors.
TY
Wind is your friend
Matt
|
|

December 7th, 2004, 07:57 AM
|
|
Friend of Wrox
|
|
Join Date: Sep 2004
Posts: 103
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Intresting...
I always thought the page would refresh immediatly after the execution of submit() and the
"showCats.eventTitle.value = createNewEvent.eventTitle.value;" would never execute at all...
|
|

December 7th, 2004, 06:11 PM
|
|
Friend of Wrox
|
|
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
|
|
nerssi
Yes, quite correct you are indeed. Semi colon I think not - no wonder there was no error, it never got to that line (it all becomes clear). Perhaps someone spiked my coffee yesturday, seems I was coding like a blunt knife. Thank you for your comments.
Wind is your friend
Matt
|
|

March 2nd, 2007, 04:20 AM
|
|
Registered User
|
|
Join Date: Mar 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
NOTHING
|
|

March 4th, 2007, 09:04 PM
|
|
Friend of Wrox
|
|
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
|
|
MolemanJake
You may have removed your post however its still in all our inboxes. What on earth are you talking about? I do not follow you, your post made no sense and had nothing to do with my original problem, nor solution. Whats your angle?
Wind is your friend
Matt
|
|

March 4th, 2007, 11:05 PM
|
|
Wrox Author
|
|
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
|
|
Matt, in the current incantation of your script it will not work (as you have pointed out), however, you may be able to use some crafty javascript to accomplish this task.
Do you HAVE to submit the form for any reason? (A call to an ASP page for instance) If you do not, why not use the visiblity property of DIV tags in your functions to show and hide your forms as necessary?? (This will give your page a bit of an ajax feel)
hth.
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========
|
|

March 4th, 2007, 11:24 PM
|
|
Friend of Wrox
|
|
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
|
|
Hi there - Yes I did solve this with JS sometime ago. Going by the dates, 2004 I believe.
I must say I was suprised to see MolemanJake's post thismorning, did you see it? He removed it 2 hours later however it remains in our in boxes of course. I remain confused about it, very strange indeed.
Wind is your friend
Matt
|
|

March 4th, 2007, 11:31 PM
|
|
Wrox Author
|
|
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
|
|
LoL, ya i normally don't look at the dates, i just see the post popup on the Active topics page and take a look at them.
I did not see the post in question, however, people do strange things here from time to time.
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========
|
|
 |