Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to populate default textarea value on select from dropdown

 
Ramakanta Sahoo
Ranch Hand
Posts: 256
Fedora Firefox Browser Netbeans IDE
  • Mark post as helpful
  • send pies
  • 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!!
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You either need t post the form back to the server or look into Ajax.

Eric
 
Joe Sondow
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
  • 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
Fedora Firefox Browser Netbeans IDE
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Ramakanta,

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

 
Ramakanta Sahoo
Ranch Hand
Posts: 256
Fedora Firefox Browser Netbeans IDE
  • Mark post as helpful
  • send pies
  • 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
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic