Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-10-2010, 07:09 PM   PM User | #1
vsahanaa
New to the CF scene

 
Join Date: Dec 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
vsahanaa is an unknown quantity at this point
Unhappy How to append two values as a URL

Hi to all,

Sorry to ak this question it may be easy but i didn't got the solution on net please provide the proper answer.

My question is : I am defining hyperlink in struts as
<a href= Javascript:formSubmit(<bean:write name="AA" property="aa">','<bean:write name="BB" property="bb">)

defining function as

function formSubmit(Aa,Bb)
{
document.forms[0].action="/accesingpage.do?method=create&AA=+Aa"

----> in above statement how to pass the second parameter(i.e Bb)....I tried different ways but giving syntax error.

please post the ans as soon as possible
vsahanaa is offline   Reply With Quote
Old 12-10-2010, 09:21 PM   PM User | #2
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,237
Thanks: 59
Thanked 3,998 Times in 3,967 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
You aren't even passing the first parameter correctly or using it correctly.
Code:
<a href="formSubmit('<bean:write name="AA" property="aa">','<bean:write name="BB" property="bb">');">
You need the apostrophes around EACH ARGUMENT, separately.

And then:
Code:
function formSubmit(Aa,Bb)
{
    document.forms[0].action=
        "/accesingpage.do?method=create&AA=" + encodeURIComponent(Aa)
        + "&BB=" + encodeURIComponent(Bb);
    ...
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 12:50 PM.


Advertisement
Log in to turn off these ads.