Trying to teach myself javascript here so do bear with me.
Why isn’t the following snippet working?
<script type="text/javascript">
function form() {
var role_id = document.contextform.role.value;
document.contextform.action="profile/" + role_id;
document.contextform.submit();
}
</script>
<form name="contextform" method="post" action="" />
<div class="input_group">
<select name="role" style="opacity: 0;" onchange="form();">
<option value="none">Select Context</option>
<option value="4">Profile 4</option>
</select>
</div>
</form>
I’m basically trying to redirect the user based on the value of the option on the drop down list. Thanks.
Frist of all,
the opacity there makes it disappeared. So, you can just remove the style.
Secondly, the name
formseemsed to be a reserved keyword. So, you can’t use that name. Try to put some other name likeform_handler()and change your html as well (with the style removed)