/    Sign up×
Community /Pin to ProfileBookmark

Input Control

I have to control hidden Inputs.
I have images from 6-30. Each of them gives a value to a hidden input when clicked. I just want to control the submit button.

To click on the submit button user has to select one of the images and has to set the specified hidden input value.

I’m giving the code below which is not working ? . Any help is appreciated.

<Html>
<head></head>

<body>

<script language=”JavaScript”>
function check() {
for (i=6; i<30; i++)
//document.write(“Say&#305; = ” + i + “<br>”);
if (document.forms[‘frm’].std[i].value != ”){
alert(“Say&#305; = ” + i + “<br>”);
return false;
}
return true;
}
</script>

<form name=”frm” action=”?x=14″ method=”post”>
<%
for i = 6 to 30
%>
<input type=”hidden” name=”std<%=i%>” value=””>
<%
next
%>
<input type=”button” value=”Submit>>” onclick=”return kontrol();”>
</form>
</body>

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@FangMay 21.2008 — Probably like this, but seeing the generated html would be usefuldocument.forms['frm'].elements['std'+i].value
Copy linkTweet thisAlerts:
@YILMAZauthorMay 21.2008 — That was perfect. Thanks a lot.

Sot this was think I was trying to do.

<script language="JavaScript">

function kontrol() {

for (i=6; i<30; i++)

//document.write("Say&#305; = " + i + "<br>");

if (document.forms['frm'].elements['std'+i].value != ''){

return true;

}

alert("Please Select an Image");

return false;

}

</script>
×

Success!

Help @YILMAZ 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 6.16,
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: @nearjob,
tipped: article
amount: 1000 SATS,

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

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...