Wrox Programmer Forums
|
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics 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
 
Old September 15th, 2008, 12:30 PM
Registered User
 
Join Date: Sep 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Form Fields

I have an anchor that calls a javascript function in a hidden top frame. I'm passing data to the function and that works fine. Now I have to pass user input to the same function.

What syntax do I use to reference the input field that collects the user input?

Does the input field need to be part of a form?

I need to reference the field in the parameters call to the function.

Thanks

 
Old September 15th, 2008, 01:25 PM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

Not to ask a silly question, but how is this related to JSP??? JSP is *server-side* Java, not JavaScript, and has nothing to do with browser-based code, per se.

Having said that...

Yes, the input field needs to be part of a form (some browsers allow it to be outside a <FORM>, but that's not per spec). It could be part of a form that contains only it, if you can see a reason for that kind of organization.

There are several possible ways to address a form field, but the cleanest is something like this:

<form name="TheForm"><input name="TheField"></form>

<script>alert("The user supplied value is " + document.TheForm.TheField.value);</script>

Is that enough? Or did I misread the question?
 
Old September 15th, 2008, 05:53 PM
Registered User
 
Join Date: Sep 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

No that's it, Sorry I was in the wrong Forum.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple Form Fields tripster General .NET 2 October 17th, 2007 04:22 AM
copy fields from Form to new form - openargs justabeginner Access VBA 1 February 4th, 2007 01:28 PM
form fields value retaining Dheeraj BOOK: Beginning JavaServer Pages 0 May 23rd, 2006 01:45 AM
how can i see the modifications in a form fields thomaz C# 1 September 7th, 2003 04:27 AM
Getting the submitted fields in a form siraj_java Javascript How-To 0 August 26th, 2003 12:38 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.