EmmaC
12-12-2010, 12:48 PM
Hi,
I have a JQuery modal window and I am trying to pass the value of its input field to a hidden input field within a form but I can not seem to get the value when it is in the modal window.
Modal Window Code:
<div id="modal-content" class="clearfix">
<h2> enter a name</h2>
<div>
<input id="enteredName" name="enteredName" type="text" value="" />
<a href="javascript:submitform(true)" name="save" id="save" class="btn"><span>Save</span></a>
</div>
<a href="javascript:submitform(false)" id="close" class="close-link">No thanks just carry on</a>
</div>
Javascript to set the value of the hidden field to equal the value of the modal input field
<script type="text/javascript">
function submitform(assignName) {
if (assignName) {
var hiddenfield = document.getElementById("hiddenfieldid");
hiddenfield.value = document.getElementById("enteredName").value;
}
var form = document.getElementById("formTest");
form.submit();
}
</script>
Any help would be much appreciated.
I have a JQuery modal window and I am trying to pass the value of its input field to a hidden input field within a form but I can not seem to get the value when it is in the modal window.
Modal Window Code:
<div id="modal-content" class="clearfix">
<h2> enter a name</h2>
<div>
<input id="enteredName" name="enteredName" type="text" value="" />
<a href="javascript:submitform(true)" name="save" id="save" class="btn"><span>Save</span></a>
</div>
<a href="javascript:submitform(false)" id="close" class="close-link">No thanks just carry on</a>
</div>
Javascript to set the value of the hidden field to equal the value of the modal input field
<script type="text/javascript">
function submitform(assignName) {
if (assignName) {
var hiddenfield = document.getElementById("hiddenfieldid");
hiddenfield.value = document.getElementById("enteredName").value;
}
var form = document.getElementById("formTest");
form.submit();
}
</script>
Any help would be much appreciated.