• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to populate default textarea value on select from dropdown

 
Ranch Hand
Posts: 256
Netbeans IDE Firefox Browser Fedora
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I am not able to get this silly question. I searched in google but didn't any satisfactory answers.
What i want is i have a default value in textarea which needs to get populated/replaced with a list of options from drop down.
Each dropdown has a big sql query named something. I want that query should get replaced with what ever is there by default in the text area.

Any examples will be great!!
Please help!!
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You either need t post the form back to the server or look into Ajax.

Eric
 
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ramakanta,

I recommend that you post a very short HTML snippet showing the type of form you have in mind, along with any JavaScript attempt you have made so far, if possible. You're more likely to get a helpful response that way. See PostRealCode and NotACodeMill
 
Ramakanta Sahoo
Ranch Hand
Posts: 256
Netbeans IDE Firefox Browser Fedora
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay as you say here is code
I made it work by this but this has no advantage.
I am having problem in putting the queries which are big and multiline in savedquery.js how do i put very big multiline queries in array values.

savedquery.js




 
Joe Sondow
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ramakanta,

You can add newline characters in your strings using \n like this:

 
Ramakanta Sahoo
Ranch Hand
Posts: 256
Netbeans IDE Firefox Browser Fedora
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes I know but my problem is
How can I put if my query is like this :

 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you DO NOT, let me repeat DO NOT want to store SQL Queries in your JavaScript. You are asking for your site to be hacked. That logic BELONGS on the server.

Eric
reply
    Bookmark Topic Watch Topic
  • New Topic