Python post form with button javascript -
i try post ads in website.
have 2 forms ,the first form ask me information of ads , ok submit them in second form, submit have button (input) javacript,
onclick="action_cmd('delete')"
i use mechanize , python .
the code javascript :
function action_cmd(action){ var hidden = document.getelementbyid("div_cmd"); hidden.innerhtml += "<>input type=\"hidden\" name=\"cmd\" value=\"" + action + "\">"; document.form_ads_action.submit(); }
the code python :
first form add information.
br.open("link") br.select_form(nr=0) br.submit()
is ok first.
for second form:
br.select_form(nr=0) br.submit()
doesn't work.
the code html :
form name="ads_action" action="link" method="post" enctype="multipart/form-data"> input type="image" name="back" id="back" value="back" onclick="action_cmd('back');"> input type="image" name="continue" id="continue" value="val"onclick="action_cmd('delete')">
pls me
you have same form number:
br.select_form(nr=0) br.submit()
if it's different form on same page, should be:
br.select_form(nr=1) br.submit()
or if want select second form, can name:
br.select_form(name = "ads_action") br.submit()
Comments
Post a Comment