It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

Submit options and open results in a new window

Submit options and open results in a new window

Postby xshane on Wed May 21, 2008 10:31 am

<script type="text/javascript">

function test() {

var customer = document.docNameSuggestor.customer.value;
var project = document.docNameSuggestor.project.value;
var doc_type = document.docNameSuggestor.doc_type.value;

var string='<table border="1" cellpadding="1" cellspacing="1"><tr>'
+ '<td><p>Suggested filename is: ' + customer + '_' + project + '_' + doc_type + '.<extension>' + '</p></td>'
+ '</tr>'
+ '<tr>'
+ '<td><p>Suggested storage path is: ...\\' + customer + '\\' + project + '\\' + doc_type + '</p></td>'
+ '</tr></table>';

document.getElementById("fileName").innerHTML= string;
}
</script>


<form name="docNameSuggestor" >
<td width="60%">
<p>Which customer is this document for?</p>
<select name="customer" >
<option>Please select</option>
<option value="Ci">Ci</option>
<option value="VF">VF</option>
<option value="H3">H3</option>
</select>

<td width="60%">
<p>Which project is this document for?</p>

<select name="project" >
<option>Please select</option>
<option value="AX1.0">AX1.0</option>
<option value="AXP2.0">AX2.0</option>
</select>

<td width="60%">
<p>Which type of document is this?</p>

<select name="doc_type">
<option>Please select</option>
<option value="CRequirements">Requirement Spec</option>
<option value="SRequirements">Software Requirement Spec</option>
</select>

<input type="submit" name="submit" value="Submit" onClick="test()">

<form action="file.html" method="post" target="_blank"></form>
</form>

These are my codes,
Q1.How can I open results in a new window after user submit selected options?
Q2:How can I populate the specific field with choices based on what user has selected from customer drop-down

Please help. Any suggestions are appreciated.
xshane
 
Posts: 0
Joined: Wed May 21, 2008 9:59 am

Postby rangana on Thu May 22, 2008 1:47 am

You don't have an element whose id is fileName yet ;)

The most that you can do is:
Code: Select all
<script type="text/javascript">

function test() {

var customer = document.docNameSuggestor.customer.value;
var project = document.docNameSuggestor.project.value;
var doc_type = document.docNameSuggestor.doc_type.value;

var string='<table border="1" cellpadding="1" cellspacing="1"><tr>'
+ '<td><p>Suggested filename is: ' + customer + '_' + project + '_' + doc_type + '.<extension>' + '</p></td>'
+ '</tr>'
+ '<tr>'
+ '<td><p>Suggested storage path is: ...\\' + customer + '\\' + project + '\\' + doc_type + '</p></td>'
+ '</tr></table>';

document.write(string);
}
</script>


...but this situation is better forth using server-side language (PHP or ASP). ;)
User avatar
rangana
500+ Club
 
Posts: 935
Joined: Wed Feb 27, 2008 5:14 am
Location: Cebu City Philippines


Who is online

Users browsing this forum: No registered users and 5 guests