Jump to content

[SOLVED] Re: form values


mgs019

Recommended Posts

I started a thread on this before but it got a little side tracked.

 

I have a form where I have a select element with numbered values which relate to diamond colours and clarities. So 1=D, 2=E etc. I also have sliders from the Yahoo UI library which work great. I want to have the value displayed but not as a select. I tried disabled="yes" and it stopped passing the variable through.

 

It seems to work for alert but not document.write!?!?!?

 

My backup plan was to use a readonly textbox with a white border so it would not show up and use javascript to process the variables so something like

 

 

var colname
var colnum = document.forms.diamond.colour.value;
if(colnum=1) colname=D
...

 

in the head as a function, then put an onchange in the inputs.

 

any chance of a bit of help in the formatting for the function, particularly the if or maybe switch part?

 

Thanks alot,

 

Martin

Link to comment
https://forums.phpfreaks.com/topic/42983-solved-re-form-values/
Share on other sites

thats what I thought but it did not work. Unless there is something really silly I am missing in the syntax. i had:

 

var x=document.forms.diamond.colour.value
document.write(x)

 

but nothing. If i put quotes around the 'x' it wrote x!

 

I am thinking of going to plan B with this so I thought if I used text fields with a transparent border then I need to translate from the id to the colour/clarity and maybe a description. I thought something like:

 

var coldesc
var colnum=document.forms.diamond.colour.value
switch(colnum)
case 1
document.forms.diamond.colourtext.value="D - Pure white..."
case 2...

 

then an onload in the body tag.

 

Will this work and how should the syntax be for the head script? I am ok with php but I am a bit of a JS noobie.

 

Thanks,

 

Martin

Link to comment
https://forums.phpfreaks.com/topic/42983-solved-re-form-values/#findComment-209107
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.