by Ange Tuteur Sun 6 Sep 2015 - 15:51
I suppose this would be a brief example of what you'll need to do. Note that you'll need a bit of knowledge in HTML, CSS, and JavaScript to modify it effectively.
Go to Modules > HTML Pages Management > Create new
Use your forum header : No
Paste the following :
- Code:
<!-- STYLES -->
<style type="text/css">
.section {
background:#EEE;
border:1px solid #CCC;
border-radius:3px;
padding:3px;
margin:10px auto;
width:80%;
}
.sectionRow {
width:80%;
margin:10px auto;
}
.section .inputbox { width:250px }
.section label {
width:80px;
font-weight:bold;
display:inline-block;
}
</style>
<!-- FORM -->
<form action="/post" method="post" name="post" enctype="multipart/form-data">
<div class="section">
<div class="h3">Section 1</div>
<!-- FAUX FORM DATA -->
<div class="sectionRow">
<label for="inputFieldName">Name :</label>
<input id="inputFieldName" type="text" placeholder="Desired name" class="inputbox" />
</div>
<div class="sectionRow">
<label for="inputFieldNumber">Number :</label>
<input id="inputFieldNumber" type="text" placeholder="Desired number" class="inputbox" />
</div>
<div style="text-align:center">
<input class="button1" type="submit" name="post" value="Submit" />
</div>
</div>
<!-- TRUE FORM DATA -->
<div style="display:none">
<input type="text" name="subject" value="Request by : " /> <!-- TOPIC TITLE -->
<input type="text" name="mode" value="newtopic" /> <!-- MESSAGE MODE -->
<input type="text" name="f" value="1" /> <!-- FORUM ID THE TOPIC GOES INTO -->
<textarea name="message"></textarea> <!-- TOPIC MESSAGE -->
</div>
</form>
<!-- SCRIPTING -->
<script type="text/javascript">//<![CDATA[
document.post.post.onclick = function() {
var name = document.getElementById('inputFieldName'),
number = document.getElementById('inputFieldNumber'),
form = document.post;
form.subject.value += name.value;
form.message.value += '[b]Username :[/b] ' + name.value + '\n[b]Desired Number :[/b] ' + number.value;
};
//]]></script>
Explanation :We'll have faux form data such as the field
inputFieldName which is denoted by a unique ID. This ID will be used later on in the JavaScript to get its value.
- Code:
<input id="inputFieldName" type="text" placeholder="Desired name" class="inputbox" />
At the bottom of the code you'll see the script which is a simple binding to the submit button. We get the previously mentioned name field there :
- Code:
name = document.getElementById('inputFieldName')
Then we can access and add it's value to other things, such as the subject :
- Code:
form.subject.value += name.value;
However, more importantly, we still need some true form data :
- Code:
<!-- TRUE FORM DATA -->
<div style="display:none">
<input type="text" name="subject" value="Request by : " /> <!-- TOPIC TITLE -->
<input type="text" name="mode" value="newtopic" /> <!-- MESSAGE MODE -->
<input type="text" name="f" value="1" /> <!-- FORUM ID THE TOPIC GOES INTO -->
<textarea name="message"></textarea> <!-- TOPIC MESSAGE -->
</div>
Each one is marked by a comment to explain the purpose.
Note : to submit the form you need to disable the following security option.
General > Security > Disallow unofficial forms to post on the form : No
If you have any questions, let me know.