Capturing dropdown value in javascript

25 views
Skip to first unread message

Rahul

unread,
Apr 16, 2009, 1:46:29 AM4/16/09
to rife-users
Hi all,

I have a drop down list like this

<!--V 'FORM:SELECT:room_type'/-->
<!--B 'FORM:LABEL:room_type:Deluxe'-->Deluxe<!--/B-->
<!--B 'FORM:LABEL:room_type:Executive'-->Executive<!--/B-->
<!--B 'FORM:LABEL:room_type:Suite'-->Suite<!--/B-->

I want to capture the value selected in the drop down in a javascript

I am trying like this

var room_type = document.getElementById('room_type').value

but it gives me null .

HOwever with

<input type="text" name="charge" id="charge" value="${v PARAM:charge}$
{/v}" />

i get the value with

var charge = document.getElementById('charge').value

Josh Hansen

unread,
Apr 16, 2009, 4:39:25 AM4/16/09
to rife-...@googlegroups.com
Hi Rahul,

Check the HTML that is generated, then code your JavaScript as you would
for normal handling of the elements based on the generated HTML.

One way to do this is to just save the generated page from the browser
as a static HTML file, then edit it directly until it does what you
need, then finally take the JavaScript code and copy it back to the RIFE
template.

Detailed questions about JavaScript are outside the scope of this
mailing list, but a search on Google should turn up plenty of resources
to help you. :)

All the best,

Josh
--
Joshua Hansen
Up Bear Enterprises
(541) 760-7685
Reply all
Reply to author
Forward
0 new messages