Posting a (ASP) Form with text area and onClick=Java... via CURL
I'm trying to pass some info to an ASP webpage. The form on the page looks as following:
<form name=onlinefo开发者_运维问答rm method=post onSubmit="javascript:return false;">
<input type=hidden name="form" value="">
<textarea name=item rows=5 cols=33 onBlur="this.value=removeSpaces(this.value);" tabindex="1"></textarea>
<input type="text" name="Email" size="26" tabindex="2">
<input type="image" src="resetButton.gif" width="60" height="30" border="0" onClick="javascript:onlineform.reset();" align="bottom" tabindex="3">
<input type="image"src="SubmitButton.gif" name="Submit" width="60" height="30" border="0" onClick=javascript:check_input() align="bottom" tabindex="4">
</form>
The email section is optional so I would only like to fill the text area and submit the form, capturing the return to be displayed later.
Problem 1 I have is the text area, problem 2 is the submit (onClick=javascript:.....).
Can anyone help?
Thanks !!!
What that onsubmit="return false;"
does is prevent the form from submitting without going through validation (the function check_input()
, which is attached to the onclick
handler). The textarea just has to execute the function removeSpaces()
to its contents (whatever that does) once it loses focus.
So really, if you are creating the input on PHP you just have to make sure your input passes validation (check_input()
) and your textarea input has "applied" the removeSpaces()
function (you might have to rewrite that in PHP).
Then you can post to the ASP script and it won't be able to tell if the form has been actually submitted via the form or not`.
Also, if you are having any difficulties, first try to post exactly the same thing as the browser would. To know/see that, you can use something like LiveHTTPHeaders and make cURL post the same fields and values as the browser. Then tweak it to your needs.
精彩评论