Page 1 of 1

access form input values

Posted: Fri Oct 01, 2010 2:33 am
by m2babaey
Hi
I was trying to access form input values but the field names are dynamic and I couldn't make it work
Any help would be extremely appreciated
This is the function that is not working

Code: Select all

function SaveRating(resourceId,order_id)
{
  var r1="response"+resourceId;
  var s1="schedule"+resourceId;
  var a1="accurate"+resourceId;
  
  
	var r=document.form1.r1.value;
	var s=document.form1.s1.value;
	var a=document.form1.a1.value;
	
	var url="orderDetail.php?resourceId="+resourceId+"&r="+r+"&s="+s+"&a="+a+"&order_id="+order_id+"&rate=1";
	window.location.href=url; 
}

Re: access form input values

Posted: Fri Oct 01, 2010 7:13 am
by DigitalMind
m2babaey wrote:

Code: Select all

   var r=document.form1.r1.value;
   var s=document.form1.s1.value;
   var a=document.form1.a1.value;
try

Code: Select all

   var r=document.form[0].r1.value;
   var s=document.form[0].s1.value;
   var a=document.form[0].a1.value;