You don't understand
The values used in Form Fields do not display on the page or affect the size of the dropdown
- they can be anything you want
All that affects the dropdown size or display to the user is what is between the <option> </option>tags
<option value="I can have a very long value in here like Fabric Color is White">White</option>
The dropdown will just show the word "White" and will be no wider than the word "White"
--
| Thanks for the lesson and your opinion. I agree, however the form and page
| do not look as nice with the added width of "fabric color", flower color",
| etc added to the drop down list.
| The onblur is a javascript event that can trigger an action when an object on the page loses focus
| - means when the form field (in your example the form field name="amt") loses focus (use leave the field) do something, and the do
| some thing is:
| Add to the field named "Total" the value of field named "constant" and the value of the field named "amt"
|
| Since it is doing math the values of "constant" and "amt" are being parsed to integer first
| - that is the reason they are surrounded by parseInt()
|
| In your new case you are trying to concatenate strings, not numbers so you would not use parseInt
|
| You could also use an event at each unique dropdown
| But you would use the onchange event (instead of the onblur event)
| - since the user is not typing anything but selecting a dropdown option (changing a selection) from a form field named FabricColor
| (the below <select> opening tag all on 1 line)
|
| <select size="1" name="FabricColor" onchange="this.form.FabricColor.value = 'Fabric Colour - ' +
| this.form.FabricColor.options.selectedIndex].value";>
| <option value="White">White</option>
| <option value="Black">Black</option>
| <option value="Beige">Beige</option>
| </select>
|
|
| IMHO
| Frankly a lot of unnecessary javascript when you could just edit the form field values to include the desired full values as say:
|
| <select size="1" name="FabricColor">
| <option value="Fabric Color - White">White</option>
| <option value="Fabric Color - Black">Black</option>
| <option value="Fabric Color - Beige">Beige</option>
| </select>
| <select size="1" name="LaceColor">
| <option value="Lace Color - White">White</option>
| <option value="Lace Color - Black">Black</option>
| <option value="Lace Color - Beige">Beige</option>
| </select>
| etc.
| --
|
| _____________________________________________
| SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
| "Warning - Using the F1 Key will not break anything!" (-;
| To find the best Newsgroup for FrontPage support see:
|
http://www.net-sites.com/sitebuilder/newsgroups.asp
| _____________________________________________
|
|
|| Thanks Steve,
||
|| Was my error , I didn't include all the info on what I was doing.
||
|| I have another question though about the code Jon gave me. On another site,
|| you or another MVP helped with some Java Sc ript math. That code was :
|| <input type="hidden" name="Total" value="0">
|| <input type="hidden" name="constant" value="20">
|| <input type="text" name="amt" size="5" onblur="this.form.Total.value =
|| parseInt(this.form.constant.value) + parseInt(this.form.amt.value)"
|| maxlength="5">
|| <input type="hidden" name="amt2" onblur="this.form.amt2.value =
|| this.form.Total.value" >
||
|| This works fine for adding a user's numeric input value to a constant.
|| There is no java script tag. How come we need it in the example Jon gave me
|| today but not in this one? And sint it possible to concatenate the same
|| way?
||
|| Thanks again,
||
|| Russell
||
||
||
||
||
|| || > I didn't know / you didn't say you were using an drop down select.
|| > Jon Spivey has given you the correct answer.
|| >
|| > --
|| > Steve Easton
|| > Microsoft MVP FrontPage
|| > 95isalive
|| > This site is best viewed............
|| > .......................with a computer
|| >
|| > || > > Well Steve, Thanks, I've been trying to no avail. Perhaps I should be
|| more
|| > > specific.
|| > >
|| > > I am sending data to a shopping cart. I need to have a user input fabric
|| > > colors and other variables. The shopping cart will display ONLY a list
|| of
|| > > the user inputs,ie blue, green, etc. It will NOT display what the
|| variable
|| > > refers to (fabric color, border color). So I would like to concatenate a
|| > > constant (Fabric color) with the users input called custom2.
|| > >
|| > >
|| > > I have the following:
|| > > <INPUT TYPE="HIDDEN" NAME="variable1" VALUE="Fabric color">
|| > > <select size="1" name="custom2">
|| > > <option value="White">White</option>
|| > > <option value="Black">Black</option>
|| > > <option value="Beige">Beige</option>
|| > > </select>
|| > > <input TYPE="submit" NAME="add" VALUE="Add to Cart">
|| > > </form>
|| > >
|| > >
|| > > I would appreciate it if you could be more specific as to what I need to
|| do
|| > > to accomplish my goals.
|| > >
|| > > Thank You,
|| > >
|| > > Russell
|| > >
|| > >
|| > >
|| > >
|| > > || > > > TY Steve, much appreciated. I will try this and report back.
|| > > >
|| > > > Russell
|| > > >
|| > > >
|| > > > || > > > > Assuming javascript:
|| > > > > Make sure the variables are global, which means they are declared
|| after
|| > > > the opening script
|| > > > > tag but before any functions.
|| > > > >
|| > > > > <script type= "text/javascript">
|| > > > > var value1
|| > > > > var value2
|| > > > > var value3
|| > > > > function myfunction(){
|| > > > > value3 = 'value1'+'value2';
|| > > > > }
|| > > > > </script>
|| > > > >
|| > > > > another way to concatenate strings inside the function is:
|| > > > >
|| > > > > value3 = 'value1'\n;
|| > > > > value3+='value2';
|| > > > >
|| > > > > --
|| > > > > Steve Easton
|| > > > > Microsoft MVP FrontPage
|| > > > > 95isalive
|| > > > > This site is best viewed............
|| > > > > .......................with a computer
|| > > > >
|| > > > > || > > > > > Thanks, but luckily they're are some MVP's that are willing to
|| show
|| > > > someone
|| > > > > > like me how to do this.
|| > > > > > I don't remember who helped but someone (maybe Steve Easton)
|| showed me
|| > > > how
|| > > > > > to add 2 numeric variables from an html form.
|| > > > > >
|| > > > > > <input type="text" name="amt" size="5"
|| onblur="this.form.Total.value =
|| > > > > > parseInt(this.form.constant.value) +
|| parseInt(this.form.amt.value)"
|| > > > > > maxlength="5">
|| > > > > > <input type="hidden" name="amt2" onblur="this.form.amt2.value =
|| > > > > > this.form.Total.value" >
|| > > > > >
|| > > > > > But now I'd like to concatenate two strings, one, user input, the
|| > > other
|| > > > a
|| > > > > > constant.
|| > > > > >
|| > > > > > Any help is greatly appreciated.
|| > > > > >
|| > > > > > Thanks
|| > > > > >
|| > > > > > Russell
|| > > > > >
|| > > > > >
|| > > > > >
|| > > > > >
|| > > > > > || > > > > > > You would have to learn to write JavaScript to accomplish
|| > > client-side
|| > > > in
|| > > > > > the browser or learn
|| > > > > > > server-side scripting (ASP, ASP.net, PHP, etc.) to accomplish
|| > > > server-side.
|| > > > > > >
|| > > > > > > --
|| > > > > > > ==============================================
|| > > > > > > Thomas A. Rowe (Microsoft MVP - FrontPage)
|| > > > > > > ==============================================
|| > > > > > > If you feel your current issue is a results of installing
|| > > > > > > a Service Pack or security update, please contact
|| > > > > > > Microsoft Product Support Services:
|| > > > > > >
http://support.microsoft.com
|| > > > > > > If the problem can be shown to have been caused by a
|| > > > > > > security update, then there is usually no charge for the call.
|| > > > > > > ==============================================
|| > > > > > >
|| > > > > > || > > > > > > > ooops,
|| > > > > > > >
|| > > > > > > > In HTML I have a form with user input (variable1) I would
|| like to
|| > > > > > > > concatenate this with either variable2 or a constant.
|| > > > > > > >
|| > > > > > > > Thanks,
|| > > > > > > >
|| > > > > > > > Russell
|| > > > > > > >
|| > > > > > > >
|| > > > > > > > || > > > > > > >> What language??
|| > > > > > > >>
|| > > > > > > >> --
|| > > > > > > >> Steve Easton
|| > > > > > > >> Microsoft MVP FrontPage
|| > > > > > > >> 95isalive
|| > > > > > > >> This site is best viewed............
|| > > > > > > >> .......................with a computer
|| > > > > > > >>
|| > > > > > > >> || > > > > > > >> > Hello,
|| > > > > > > >> >
|| > > > > > > >> > I would like to concatenate user input (variable1) with a
|| > > > constant
|| > > > > > or
|| > > > > > > >> > variable2. Any help would be appreciated.
|| > > > > > > >> >
|| > > > > > > >> > Russell
|| > > > > > > >> >
|| > > > > > > >> >
|| > > > > > > >>
|| > > > > > > >>
|| > > > > > > >
|| > > > > > > >
|| > > > > > >
|| > > > > > >
|| > > > > >
|| > > > > >
|| > > > >
|| > > > >
|| > > >
|| > > >
|| > >
|| > >
|| >
|| >
||
||
|
|