mgs019 Posted March 16, 2007 Share Posted March 16, 2007 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 Quote Link to comment Share on other sites More sharing options...
fenway Posted March 16, 2007 Share Posted March 16, 2007 Disabled will prevent that input from being submitted. If you can alert it, you can write it out... Quote Link to comment Share on other sites More sharing options...
mgs019 Posted March 16, 2007 Author Share Posted March 16, 2007 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 Quote Link to comment Share on other sites More sharing options...
fenway Posted March 20, 2007 Share Posted March 20, 2007 I'm still quite confused... seems like you're not pulling the right value, if x is null/undefined. Quote Link to comment Share on other sites More sharing options...
mgs019 Posted March 20, 2007 Author Share Posted March 20, 2007 For interest I still could not get it t owork properly so used an Iframe with a script to change teh src dependant on the form values. That worked well. Martin Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.