Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Send hidden rs fields if checkbox is true

Status
Not open for further replies.

danieljoo

MIS
Oct 9, 2002
43
0
0
US
I don't think I can do the javascript function with the rs's, is there another way? I need to send the hidden fields if AttendeeFirstName is checked.


<script type=&quot;text/javascript&quot; language=&quot;JavaScript&quot;>
<!--
function hiddenfields() {
if (
attendeelist.AttendeeFirstName.checked == true

{
<input type=&quot;hidden&quot; name=&quot;&CustomerNumber&quot; value=&quot;<%=RS(&quot;CustomerNumber&quot;)%>&quot;>
<input type=&quot;hidden&quot; name=&quot;&AttendeeLastName&quot; value=&quot;<%=RS(&quot;AttendeeLastName&quot;)%>&quot;>
<input type=&quot;hidden&quot; name=&quot;&City&quot; value=&quot;<%=RS(&quot;AttendeeCity&quot;)%>&quot;>
<input type=&quot;hidden&quot; name=&quot;&State&quot; value=&quot;<%=RS(&quot;AttendeeState&quot;)%>&quot;>
}
}
//-->
</script>

....


<td><input type=&quot;checkbox&quot; name=&quot;AttendeeFirstName&quot; value=&quot;<%=RS(&quot;AttendeeFirstName&quot;)%>&quot;></td>
 
try something along these lines
<script type=&quot;text/javascript&quot; language=&quot;JavaScript&quot;>
<!--
function hiddenfields() {
if (attendeelist.AttendeeFirstName.checked == true)
{
form name.innerHTML += '<input type=&quot;hidden&quot; name=&quot;CustomerNumber&quot; value=&quot;<%=RS(&quot;CustomerNumber&quot;)%>&quot;>'


the server side coding will run and fill the values in the if statement even know the function has not been call. I believe in order for NN to be compatible here you need to call the form by use of id or name however
document.getElementById(&quot;form ID&quot;).innerHTML

if for some reason the values do not get populated initialy (which I'm confident they will) you can set global variables in your javascript coding and add your recordset values at that point and simply transfer them to the function as needed.
for the best results to your questions: FAQ333-2924
Is your question a most FAQ?? Find out here FAQ333-3048
 
I would just check the checkbox's value on the form handler page. If it's &quot;on&quot; (checked) then use it....

page1.asp
<input type=&quot;hidden&quot; name=&quot;AttendeeFirstName&quot; value=&quot;<%=RS(&quot;AttendeeFirstName&quot;)%>&quot;>
<input type=checkbox name=&quot;firstNameBox&quot;>


page2.asp
checkBox = request(&quot;firstNameBox&quot;)
if checkBox = &quot;on&quot;
firstName = request(&quot;AttendeeFirstName&quot;)
else
firstName = &quot;&quot;
end if Get the Best Answers! faq333-2924
Is this an asp FAQ? faq333-3048

mikewolf@tst-us.com
 
A little background...the user has two possible ways to select information for printing, one is from a print icon next to each listing or a checkbox (as stated above) that allows the user to select what they what to print, here is what I have done with the code above, not quite working...


If Request.Querystring(&quot;CustomerNumber&quot;)= &quot;on&quot; then
MyVar2 = request(&quot;AttendeeFirstName&quot;)
MyVar3 = request(&quot;AttendeeLastName&quot;)
else
MyVar1 = Request.Querystring(&quot;CustomerNumber&quot;)
MyVar2 = Request.Querystring(&quot;AttendeeFirstName&quot;)
MyVar3 = Request.QueryString(&quot;AttendeeLastName&quot;)
'MyVar4 = Request.QueryString(&quot;Orderby&quot;)
end if
strsql = &quot;select * from Customer WHERE CUSTOMERNUMBER=&quot; & myVar1 & &quot;&quot;
 
oops, also tried with adding this to the first part of the if statement.

MyVar1 = Request.Querystring(&quot;CustomerNumber&quot;)
 
I'm a little confused...

You are setting the values either way?

I'm a little confused... [dazed] Get the Best Answers! faq333-2924
Is this an asp FAQ? faq333-3048

mikewolf@tst-us.com
 
sorry, forgot to add the hidden fields. But still once I added them , it went through and selected all AttendeeFirstNames and all AttendeeLastNames that matched that CustomerNumber
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top