hi all,
I have problem while getting value of combobox in chronoform. here my code ....
javascript:
its working in normal html page. but inside of chronoform only not able to get value....
can any one help.....?
thanks in advance...
regards,
THIRUPATHY.M
I have problem while getting value of combobox in chronoform. here my code ....
<select id="status" name="status" >
<option value="new">--New--</option>
<option value="in progress">--In progress--</option>
<option value="delivered">--Delivered--</option>
</select>
javascript:
var w = document.ChronoContact_myform.status.selectedIndex; // myform is the name of chrono form.
var selected_text = document.ChronoContact_myform.status.options[w].text; // status is the name of dropdown box.
alert(selected_text);
its working in normal html page. but inside of chronoform only not able to get value....
can any one help.....?
thanks in advance...
regards,
THIRUPATHY.M
Hi Thirupathy,
I don't see anything wrong except that there's no event trigger to execute the JavaScript.
Bob
I don't see anything wrong except that there's no event trigger to execute the JavaScript.
Bob
yes everything correct,but am not able to get combobox value...
here my confusion.
regards,
THIRUPATHY.M
here my confusion.
regards,
THIRUPATHY.M
Any idea........................GreyHead....?
thanks in advance.
regards,
THIRUPATHY.M
thanks in advance.
regards,
THIRUPATHY.M
Hi Thirupathy,
do you get something when you use .value in the 2nd line ?
Max
do you get something when you use .value in the 2nd line ?
Max
Hi Thirupathy,
Here's how I would do this using MooTools syntax (you may need to turn Validation on to make sure that the library is loaded).
window.AddEvent makes sure the code isn't run until the page is loaded (this is part of the problem with the existing code).
status.addEvent attaches the code to the select box to make sure it runs whenever the selection changes.
Bob
Here's how I would do this using MooTools syntax (you may need to turn Validation on to make sure that the library is loaded).
<?php
$script = "
window.addEvent('domready', function() {
var status = $('status');
status.addEvent('change', function(event) {
var w = status.selectedIndex;
var selected_text = status.options[w].text;
alert(selected_text);
});
});
";
$doc =& JFactory::getDocument();
$doc->addScriptDeclaration($script);
?>
<select id="status" name="status" >
<option value="new">--New--</option>
<option value="in progress">--In progress--</option>
<option value="delivered">--Delivered--</option>
</select>
All this goes in the Form HTML box. window.AddEvent makes sure the code isn't run until the page is loaded (this is part of the problem with the existing code).
status.addEvent attaches the code to the select box to make sure it runs whenever the selection changes.
Bob
This topic is locked and no more replies can be posted.