JS Submit and set the form's value _ form effects

Source: Internet
Author: User
Tags eval
<input type= "button" id= "BtnUdf7" name= "BtnUdf7" style= "<%=showudf7flag&&showudfbtn7flag"? "": "Display:none;" %> "value=" ... "class=" Btnlook "style=" "onclick=" Openlookupgen (Arrsetaweight, Arrgetaweight, ' <%= Eusutil.getpage ("lookup.generic.bucode.s")%>?udfindex=7&codelabel= ' +encodeuricomponent (getUdfStr (' 7 ')), ", 640, and ' Yes '" >
var arrsetaweight = new Array ();
var arrgetaweight = new Array ();
var arraweightparam = new Array ();
ARRSETAWEIGHT[0] = "document." Impdeclform.udfvalue7 ";
ARRGETAWEIGHT[0] = "document." Bucodesearch.codefield ";
function Openlookupgen (arrsetfield,arrgetfield,strpage,arrparam,width,height,scroll,left,top)
{
var BrowserType;
WX = 640; WY = 480;
var x, y;
var x1 = parseint (left);
var y1 = parseint (top);
if (isNaN (x1))
{
x = (SCREEN.WIDTH-WX)/2;
}
Else
{
x = x1;
}
if (isNaN (y1))
{
y = (Screen.height-wy)/2;
}
Else
{
y = y1;
}
str = Navigator.appName.toUpperCase ();
if (Str.indexof ("NETSCAPE") >= 0)
{
BrowserType = "NN";
}
Else
{
BrowserType = "IE";
}
var strurl = "";
if (Strpage.indexof ("?") >= 0)
strURL = strpage + "&";
Else
strURL = Strpage + "?";
for (Var i=0 i < arrsetfield.length; i++) {
if (i!= 0) strURL = strURL + "&";
strURL = strURL + "SetField" + i + "=" + arrsetfield[i];
strURL = strURL + "&getfield" + i + "=" + arrgetfield[i];
}
if (arrsetfield.length = 0)
strURL = strURL + "nooffield=" + arrsetfield.length;
Else
strURL = strURL + "&nooffield=" + arrsetfield.length;
for (Var i=0 i < arrparam.length; i++) {
strURL = strURL + "&" + arrparam[i];
}
Modified by Minjie Zhu on 2007-01-15
var name= "Lookup";
if (strpage== "Lookupproduct") {
Name= "";
}
if (browsertype== "NN")
{
Add Scrollbars=yes by Shuang at 2006-12-20
var win = window.open (strURL, Name, "Width=" +width+, height= "+height+", Resizable=yes,scrollbars=yes, Status=no, Menubar=no, toolbar=no,screenx= "+x+", screeny= "+y";
}
Else
{
Add Scrollbars=yes by Shuang at 2006-12-20
var win = window.open (strURL, Name, "Width=" +width+, height= "+height+", Resizable=yes, Status=no,scrollbars=yes, Menubar=no, toolbar=no,left= "+x+", top= "+y";
}
}
function SubmitForm (fm,pagenumvalue) {
Fm.pagenum.value=pagenumvalue;
Fm.submit ();
}
function Copyvaluetotarget (str)
{
Document. BuCodeSearch.codeField.value = str;
SetValue ();
return true;
}
function SetValue () {
var Arrsetfield = new Array ();
var Arrgetfield = new Array ();
var setobj, Getobj;
var strval, Strgettype, Strsettype;
<% for (int i=0 i < Nooffield; i++) {
Out.println ("arrsetfield[" + i + "] = ' opener." + Request.getparameter ("SetField" + i) + "';");
Out.println ("arrgetfield[" + i + "] = '" + request.getparameter ("GetField" + i) + "';");
}
%>
for (var i = 0; i < <%=noOfField%>; i++) {
Setobj = eval (arrsetfield[i]);
Getobj = eval (arrgetfield[i]);
if (setobj = null)
Myalert ("Setobj Null");
if (Setobj.type!= null)
Strsettype = Setobj.type;
Else
Strsettype = Setobj[0].type;
if (getobj = null)
Myalert ("Getobj Null");
if (Getobj.type!= null)
Strgettype = Getobj.type;
Else
Strgettype = Getobj[0].type;
Getting values from LookUp form
Switch (strgettype) {
Case "Radio":
Get value from Lookup radio button
for (var j = 0; J < Getobj.length; J + +) {
if (getobj[j].checked = = "1") {
Strval = Getobj[j].value;
}
}
Break
Case "checkbox":
Get value from Lookup radio button
if (getobj.checked = = True)
Strval = Getobj.value;
Else
Strval = "";
Break
Case "Select-one":
Strval = Getobj.options[getobj.selectedindex].text;
Break
Default
Strval = Getobj.value;
Break
}
Setting values into Parent form
Switch (strsettype) {
Case "Radio":
Set value for parent radio button
for (var j = 0; J < Setobj.length; J + +) {
if (setobj[j].value.touppercase () = = Strval.touppercase ())
Setobj[j].checked = true;
Else
setobj[j].checked = false;
}
Break
Case "checkbox":
alert (Setobj.value);
alert (strval);
if (Getobj.type = "checkbox")
setobj.checked = getobj.checked;
else if (strval.touppercase () = SetObj.value.toUpperCase ())
Setobj.checked = true;
Else
setobj.checked = false;
Break
Case "Select-one":
Myalert (setobj.length);
for (var j = 0; J < Setobj.length; J + +) {
Myalert (Setobj.options[j].text.touppercase ());
if (setobj.options[j].text.touppercase () = = Strval.touppercase ())
Setobj.options[j].selected = true;
Else
setobj.options[j].selected = false;
}
Break
Default
Setobj.value = Strval;
Break
}
}
Opener.focus;
Self.close ();
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.