Replies: 0
I have the following Form Tag and Javascript code with the intention to be able to automatcially assign values to a text field based on user select option. I haven’t succeeded yet. Any help would be appreicated
<p>Property Type <br />
[select* mc4wp-PROPTYPE include_blank "Residential Property" "Commercial Property" "Large Scale Facility"] </p>
[group group-residential]
<fieldset>
<p>Residential Type <br />
[select mc4wp-MENURESIDE include_blank "Self Contain" "Flat" "Town House" "Detached Bungalow" "Semi-Detached Bungalow" "Detached Duplex" "Semi-Detached Duplex" "Terraced Duplex" "Terraced Bungalow"]</p>
<p>No of Rooms:
[select mc4wp-NOOFROOMS include_blank "1" "2" "3" "4" "5" "6"]</p>
</fieldset>
[/group]
[group group-commercial]
<p>Commercial Type: <br />
[select mc4wp-MENUCOMM include_blank "Office Space" "Warehouse" "Shop in a Mall" "Shop in Complex" "Whole Building"]</p>
<label>Size of Space Needed (sqm): [number mc4wp-COMMSQM]</label>
[/group]
[group group-facilities]
<p>Facility Type: <br />
[select mc4wp-MENUFACIL include_blank "Retail" "Sporting" "Restaurant" "Educational" "Hotel" "Hospital" "Recreational" "Manufacturing"]</p>
<label>Size of Facility Needed (sqm): [number mc4wp-FACILSQM]</label>
[/group]
[cf7mls_step step-1 "Next"]
<label>What's your Budget(N): [select* mc4wp-BUDGET id:mc4wp-BUDGET include_blank "1 - 5 million" "6 - 15 million" "16 - 30 million" "31 - 70 million" "71 - 100 million" "101 - 150 million" "151 - 250 million" "251 - 500 million" "above 500 million"]</label>
[text repfee id:repfee class:repfee "N25,000 (Twenty Five Thousand Naira)"]
<p>Would you need a mortgage: <br /> [radio mortgage default:1 "No" "Yes"] </p>
<p>Are you open to pre-construction offers: <br /> [radio pre-construction default:1 "No" "Yes"] </p>
<p>Location (type location and click 'SET')
[location mc4wp-LOCATION]</p> <br />
[cf7mls_step step-2 "Back" "Next"]
<p>Your FULL Name <br />
[text* mc4wp-NAME]</p>
<label> Your Mobile No [tel* mc4wp-TELNO]</label>
<p>Your Email<br />
[email* mc4wp-EMAIL] </p>
<p>Your Address<br />
[address_geo_autocomplete* Mailing-Address]</p>
<p style="float:right">
[mc4wp_checkbox]
[submit "SUBMIT"]
</p>
<script language=”javascript” type=”text/javascript”>
document.getElementById(“mc4wp-BUDGET”).addEventListener(“change”, displayTextField);
function displayTextField() {
var Chosen = document.getElementById(“mc4wp-BUDGET”).value;
switch (Chosen){
case "1 - 5 million":
document.getElementById(“repfee”).value = “N25,000 (Twenty Five Thousand Naira)”;
break;
case "6 - 15 million":
document.getElementById(“repfee”).value = “N50,000 (Fifty Thousand Naira)”;
break;
case "16 - 30 million":
document.getElementById(“repfee”).value = “N100,000 (One Hundred Thousand Naira)”;
break;
case "31 - 70 million":
document.getElementById(“repfee”).value = “N150,000 (One Hundred and Fifty Thousand Naira)”;
break;
case "71 - 100 million":
document.getElementById(“repfee”).value = “N250,000 (Two Hundred and Fifty Thousand Naira)”;
break;
case "101 - 150 million":
document.getElementById(“repfee”).value = “N350,000 (Three Hundred and Fifty Thousand Naira)”;
break;
case "151 - 250 million":
document.getElementById(“repfee”).value = “N500,000 (Five Hundred Thousand Naira)”;
break;
case "251 - 500 million":
document.getElementById(“repfee”).value = “N1,000,000 (One Million Naira)”;
break;
case "above 500 million":
document.getElementById(“repfee”).value = “N2,000,000 (Two Million Naira)”;
break;
}
}
</script>