I've been working on a form which is an order form that needs to validate whether all the quantity fields on the form are not zero to see that the order has at least one item ordered. To do that I've created some javascript, but to get it working, I needed to call that validation function onto the form name as an attribute in the submit button:
<input type="submit" onclick="validate(orderform);" id="submit" name="form[submit]" value="Submit"/>
However, I've found that there's no form name variable put in when the RSForm is generated for display:
<form id="userForm" action="" enctype="multipart/form-data" method="post">
So, to fix it, some tweaks to components/com_rsform/controller/functions.php are needed:
On Line 720, change:
$q="select FormLayout, ScriptDisplay from $RSadapter->tbl_rsform_forms where FormId='$formId'";
to
$q="select FormLayout, ScriptDisplay, [b]FormName[/b] from $RSadapter->tbl_rsform_forms where FormId='$formId'";
This adds the formname to the query.
Next at Line 728 (or thereabouts) add this to tidy up the form name and create the string:
$formName=stripslashes($r['FormName']);
Finally around line 780 change:
$formLayout = '<form method="post" id="userForm" enctype="multipart/form-data" action="">'.$formLayout.'</form>';
to
$formLayout = '<form method="post" [b]name="'.$formName.'"[/b] id="userForm" enctype="multipart/form-data" action="">'.$formLayout.'</form>';
This then adds the name="<formname>" value into the form tag, and you can then call it for extra validation.
The final step is in your form, and the formname is the form name field when you create the form. It's probably advisable that you keep this now shorter and not having spaces in it too.