Link to home
Start Free TrialLog in
Avatar of dgrafx
dgrafxFlag for United States of America

asked on

form email value

Hello ...
Really simple question.
I don't code in jsp but need to provide a line of code to an affiliate - and instead of searching I thought I'd post here.

On a .jspa page there will be form.fieldnames & values available.

I need to send form.email to a remote url and so the link would look like
page.cfm?email=form.email

In jsp, how do I write this?
Meaning is there a character(s) around it or ???

Yes, this question is as simple as it appears.
Avatar of bloodredsun
bloodredsun
Flag of Australia image

Avatar of dgrafx

ASKER

OK - not in that sense.
It's so simple I have trouble explaining it.

How do I say that "form.email" is the value of the variable form.email?
Like is it %form.email% or something.
What character is used in jsp?
Avatar of fargo
fargo

May be you can make use of hidden values and javascript

<script>
      function update(){
         document.formname.email.value=document.emailformname.email.value;
        document.formname.submit();
      }
</script>

// this is another form with hidden field
<form name="emailformname" method="post" action="http://yoursite.com/page.cfm">
<input type="hidden" name="email"/>
</form>

Hope it helps.
fargo
forgot to say, when u click on the link u have to make use of onclick event.
 <a href="#" onclick="update();">Click me</a>
i don't think my post will work...forget it!
Avatar of dgrafx

ASKER

OK - Let me try again.
I don't need help with how to build a link or javascript.
I don't need help with how to send the email value back to us.
I just don't know jsp and I don't have time to learn.

I need to know how to say that this text "form.email" evaluates to "someone@adomain.com" and is not just text - it is a variable.
What is the character used to say "this is a variable value"?

You're thinking above what I need - this is something a person would learn the first day if learning jsp.
I don't think i got your point. But still will try to explain..

In an html link and parameter that comes after "?" in a link is for parameters passed to the link.
ex: http://yoursite.com/page.cfm?email=youremail&moreparam=morevalue.
here email and moreparam are parameters OR variables (in your term) and youremail and morevalue is value associated with it. The first parameter is appended to the link with "?" and further with "&". Parameters needs to be encoded too.

>>how to say that this text "form.email" evaluates to "someone@adomain.com" and is not just text - it is a variable.
What do u mean?


either:

  ${form.email}

or

  <%= form.getEmail() %>

or

  <c:out value="${form.email}"/>

Depending on which version of JSP you are running, whether you have JSTL, and how the bean represented by "form" is set up...

Tim
Avatar of dgrafx

ASKER

Now we're getting somewhere
So I'd say "page.cfm?email=${form.email}" ?

the page name is loginsubmit.jspa - does that say anything?
if not, will one of the versions of "form.email" you posted work in all?

I don't know jsp but need to supply code for one of their (affiliate) pages.
Yes, I too wondered why they couldn't just do something simple for us.
I have no idea what a jspa file is... :-/

If it's just a standard JSP then it depends what "form.email" is...

is "form" a variable containing a bean?
Avatar of dgrafx

ASKER

?
Lets just say it's a standard jsp page.
form.email comes from a form submission on a previous page.
I don't know enough about beans to say if it contains a bean.

1) users enter email & password on a login page - then submit the form
2) I just need to grab the value of the form field named "email"

I believe it's just as simple as that, and if they are using "beans" to do other "stuff" - I should still be able to get "form.email" - is that correct?
ahhhhhhhhhhhh

I get it now!

    <%= request.getParameter( "email" ) %>

should do it :-)
Avatar of dgrafx

ASKER

so it's page.cfm?<%= request.getParameter( "email" ) %>

is that correct?
if not, will you write it out please.
or:

    ${param.email}

if it's a JSP 2.0 container :-)

Tim
>> is that correct?

That should do it...
Avatar of dgrafx

ASKER

https://ourdomain.com/qh/leadssignup.cfm?<%=request.getParameter("email")%>
or
https://ourdomain.com/qh/leadssignup.cfm?${param.email}

is this correct?
Avatar of dgrafx

ASKER

I meant to add will this send a url param named email to the cfm page?
ASKER CERTIFIED SOLUTION
Avatar of TimYates
TimYates
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dgrafx

ASKER

OK - great
I told you guys this was really simple!
It was so simple I couldn't explain it!

Thanks a lot
:-)  Glad we got it sorted out in the end :-)

Good luck with it all!!

Tim