0

Hey I want to reset the form but i don't know how. i mean where should i add event. I want that form should be reset just after i submit the form or before the result is loaded in iframe.

<div class="mainArea">
        <iframe id="uploadTarget" name="uploadTarget" src="OnlineExam?q=allQuestions" 
        style="width:15%;height:100%;border:1px solid #fff; float:left;" >          
        </iframe>       
        <div id="questionArea">
        <h1 class="headingClassC">Please Input Questions: </h1>
        <br class="clearFormatting"/>
        <span class="instructions"><br/>
        1. You can use HTML tags to format your text
        <br/>
        2. To Edit a previously inserted question please click on the question no. shown on the left side.<br/>
        3. You can attach an image file with the question which will be used as reference. <br/>
        </span>     
        <form action="OnlineExam?q=saveQuestion" method="post" target="uploadTarget" id="inputQuestionForm">
        <fieldset>
        <legend>Question</legend>
        <textarea class="questionArea" id="question" name="question">Enter Question.</textarea>
        <br class="clearFormatting"/>               
        <input class="optionsInput" value="optionA" name="optionA" onfocus = "clearValues('optionA')" onblur = "setValues('optionA')"/>
        <br class="clearFormatting"/>

        <input class="optionsInput" value="optionB" name="optionB" onfocus = "clearValues('optionB')" onblur = "setValues('optionB')"/>
        <br class="clearFormatting"/>

        <input class="optionsInput" value="optionC" name="optionC" onfocus = "clearValues('optionC')" onblur = "setValues('optionC')"/>
        <br class="clearFormatting"/>

        <input class="optionsInput" value="optionD" name="optionD" onfocus = "clearValues('optionD')" onblur = "setValues('optionD')"/>
        <br/>
        <input class="optionsInput" value="answer" name="answer" onfocus="clearValues('answer')" onblur="setValues('answer')"/>     
        <input type="submit" value="Save"/>
        <input type="reset" value="Cancel" />
        <button style="display: none" onclick="return deleteQuestion()" >Delete</button>        
        </fieldset>
        </form>
        <br/><br/>
        Once you have finished inputing question <a href="OnlineExam?q=ready">click here</a> to go back.

        </div>      
    </div>
codeomnitrix
  • 4,179
  • 19
  • 66
  • 102

1 Answers1

0

misread your question...

You need to use javascript to reset the form. Here is a good start for doing that:

Resetting a multi-stage form with jQuery

you should add a script in your iframe to call into the parent frame and clear the form once the iframe loads.

You obviously cant clear the form before the submit event.

Community
  • 1
  • 1
mkoryak
  • 57,086
  • 61
  • 201
  • 257