/    Sign up×
Community /Pin to ProfileBookmark

Textarea’s Problem

Hi,

I have created a html userform to be used by people in my office.

the form has a number of dropdown lists, textboxes & radio buttons, checkboxes.

at the bottom of the form there are 2 textareas named, Problem & Solution.

If i select any item from the dropdown list or say click on a radio button, or put a tick inside a checkbox, it should enter the name of that radio or checkbox or textbox or dropdown list into the 1st textarea named “Problem” & it should enter the text value of the radio or checkbox or textbox or dropdown list into the textarea below which is named “Solution”.

for e.g.

Suppose there is a dropdown list (Named “Error No”) which shows 3 options:
1. Modem Error 690
2. Modem Error 721
3. Modem Error 633

Say, i select 1. Modem Error 690

so, 1st Textarea “Problem” will show:
Error No: Modem Error 690

& 2nd Textarea “Solution” will show, say:
“Adviced customer to re-enter username & password correctly.”

(I need to know, what this text “Adviced customer to re-enter username & password correctly…” will be? will it be a “Value” for the 1st selected option…….
If so, how to do the same for all the different Elements & how to get their values into the 2nd Textarea “Solution”…..

PLEASE HELP ASAP!

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@phpnoviceMar 15.2006 — Yes, you would place that text as the value of the OPTION tag. Then:
<i>
</i>&lt;select name="Error No" size="1" onchange="
var opt = this.selectedIndex;
this.form.Problem.value = this.options[opt].text;
this.form.Solution.value = this.options[opt].value;
return true;"&gt;
Copy linkTweet thisAlerts:
@sifarauthorMar 16.2006 — Yes, you would place that text as the value of the OPTION tag. Then:
<i>
</i>&lt;select name="Error No" size="1" onchange="
var opt = this.selectedIndex;
this.form.Problem.value = this.options[opt].text;
this.form.Solution.value = this.options[opt].value;
return true;"&gt;
[/QUOTE]

hi,

thanks for the quick reply...

But what about other elements like Radio buttons, Textboxes, checkboxes....will they also have a Name, Text & Value property which i can manipulate & how???
Copy linkTweet thisAlerts:
@phpnoviceMar 16.2006 — But what about other elements like Radio buttons, Textboxes, checkboxes....will they also have a Name, Text & Value property which i can manipulate & how???[/QUOTE]
No, they do not have a [B]text[/B] property -- only the SELECT OPTION has that. This is because the text loosely associated with those other elements can be HTML in nature (not just plain text). The SELECT OPTION text, on the other hand, can *only* be plain text. Othewise, yes, you can manipulate the [b]value[/b] property of other elements. The syntax is much the same as I have already posted. The general format is:

document.formName.elementName.value

Exceptions occur when more than one element has the same [b]name[/b] property. Then you must reference them as arrays:

document.formName.elementName[index].value

The FORM SELECT element is the other exception: because it has an [b]options[/b] collection embeded within it (as previously demonstrated).
Copy linkTweet thisAlerts:
@sifarauthorMar 16.2006 — Hi PHPNovice,

Can i send you my html file along with the *.js file & *.css file, for your perusal....i tried sending the code here, but has restrictions on number of characters to send.....

PLEASE HELP
Copy linkTweet thisAlerts:
@phpnoviceMar 16.2006 — I don't wish to go wading through your entire document source on my own dime (time). It is much better if you figure out where the problems are and post just that part of your source -- along with a description of what is the problem. Thanks.
×

Success!

Help @sifar spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.15,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...