Capturing dropdown value in javascript

View: New views
2 Messages — Rating Filter:   Alert me  

Capturing dropdown value in javascript

by Rahul-36 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "rife-users" group.
To post to this group, send email to rife-users@...
To unsubscribe from this group, send email to rife-users+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rife-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Capturing dropdown value in javascript

by Joshua Hansen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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


Rahul wrote:

> 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
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "rife-users" group.
To post to this group, send email to rife-users@...
To unsubscribe from this group, send email to rife-users+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rife-users?hl=en
-~----------~----~----~----~------~----~------~--~---

 
 
 
Google
rifers.org web