Trying to mix JavaScript and coldfusion unsuccesfully

i am trying to create a simple form where people choose their templates. this is within a larger page as a cfdiv element. on click, i want to navigate over to the template.

I need to get the "[document.getElementById('TemplateType').value]" or something like that too actually work.

thank you in advance.
this works if i hardcode a file template name (areatemplate1, areatemplate2, etc)

<cfform name="TemplateChange">
        <cfinput name="AID" value="#AID#" type="hidden">
            <select name="TemplateType">
                  <option value="1">1</option>
                <option value="2">2</option>
                <option value="3">3</option>
                <option value="4">4</option>
            <br />
            <cfinput type="submit" id="saveID" value="save" name="save" onClick="ColdFusion.navigate('/cms/arealist/areatemplates/areatemplates/areatemplate[document.getElementById('TemplateType').value]', 'templateDiv');"  >
            <cfinput type="submit" id="close" value="close" name="close">
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

you concatenate strings and js variables like this:
'string' + jsvariable

so your onclick event should look like this:
onclick="ColdFusion.navigate('/cms/arealist/areatemplates/areatemplates/areatemplate' + document.getElementById('TemplateType').value, 'templateDiv');"

i am also not sure i would put it as onclick event in a submit button - unless you really want to also submit the form when the button is clicked. otherwise, either use cfinput type="button" or add return false; to the end of onclick event to prevent form submission:
onclick="ColdFusion.navigate('/cms/arealist/areatemplates/areatemplates/areatemplate' + document.getElementById('TemplateType').value, 'templateDiv'); return false;"


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ojohnsonAuthor Commented:
Ok thank you. I do need to the form to submit as well. Thank you for your quick response
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.