/    Sign up×
Community /Pin to ProfileBookmark

Have to hit "Edit" twice to redirect back

Hello, I have a detailed form that has alot of javascript in it. The below section is required for it to run but when I have it in the page I have to hit the “Edit” button twice before it routes back to the previous page. Right now all it does is reload the same page its on. Everytime it takes 2 times hitting the button before It works correctly. If I take out the code then of course my javascript doesn’t work but my page redirects back fine.

Does anyone see what could be causing this?

Code in question———————-

<script language=”javascript”>
function reset_onclick(x){document.formc.reset();postcode();recalc_onclick(”);};function postcode(){};function
eequerystring(){var
querystring=document.location.search;if(querystring.length>0){variables=(querystring.substring(1)).split(“&”);var
variable;var key;var value;for(var
ii=0;ii<variables.length;ii++){variable=variables[ii].split(“=”);key=unescape(variable[0]);value=unescape(variable[1]);if(doc
ument.formc[key]!=null){document.formc[key].value=value;}}}}function
initial_update(){postcode(”);eequerystring();recalc_onclick(”);}
</script>

End——————————

<input type=submit value=” Edit ” onclick=”history.back()”>
<input type=button value=” Cancel ” onclick=”history.back()”>
<input type=hidden name=action value=”save”>
<input type=hidden name=page value=[[#_page]]>
<input type=hidden name=search value=[[#_
search]]>
<input type=hidden name=record value=[[#_record]]>
</form>

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@HDCauthorSep 07.2006 — I have narrowed it down to the culprit being this function:

recalc_onclick('');

When I take it out in both places the edit works fine but the initial browser onload does not show my text field until I click the mouse anywhere on the page instead of just showing on the page like it did before.

Can I change something here to allow them both to work? Any ideas?
×

Success!

Help @HDC spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.10,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...