CharlottesWW
09-25-2011, 06:19 PM
To order a customized product from my site, the user has to upload an image and then submit text (separate steps but part of the same php form) before adding to their cart. Currently, the user must scroll back down from the top of the page to the next part of the form after each step which is more confusing than I would like.
The first step of the form uses a straight forward <form> and I was able to add an action="#anchor" to jump down to where I set the first anchor.
The second step is regrettably not so straight forward and I'm having trouble adding an anchor. After entering text, the user clicks a submit button which triggers an alert letting them know the text was submitted successfully. When the user clicks the okay button on the popup alert, I would like the page to jump down to the 'add to cart' portion.
This is the button:
echo '<tr>
<td valign="bottom" colspan="2" align="center">
<input id="delete_button" class="button" type="submit" value="Attach Text" onclick="return( confirm( this.form ) );" />
</td>
</tr>';
And this is the alert: echo vmCommonHTML::scriptTag('', "function confirm( form ) {
form.task.value='confirm_text';
alert('Your text was successfully attached.');
return true;
}" );
How can I prevent the page from returning to the top after the user submits text?
Thank you,
Charlotte
The first step of the form uses a straight forward <form> and I was able to add an action="#anchor" to jump down to where I set the first anchor.
The second step is regrettably not so straight forward and I'm having trouble adding an anchor. After entering text, the user clicks a submit button which triggers an alert letting them know the text was submitted successfully. When the user clicks the okay button on the popup alert, I would like the page to jump down to the 'add to cart' portion.
This is the button:
echo '<tr>
<td valign="bottom" colspan="2" align="center">
<input id="delete_button" class="button" type="submit" value="Attach Text" onclick="return( confirm( this.form ) );" />
</td>
</tr>';
And this is the alert: echo vmCommonHTML::scriptTag('', "function confirm( form ) {
form.task.value='confirm_text';
alert('Your text was successfully attached.');
return true;
}" );
How can I prevent the page from returning to the top after the user submits text?
Thank you,
Charlotte