Hi everyone, kinda new to Javascript.
Here is the issue, I have a form that sends to a different action based on the button pushed. But it also is sending variables to the server as well.
Here is the JS:
We are trying to change away from just ?ADD or ?UPD because every once and awhile the server seems to get confused.
Instead we are trying to do something more like
This way the parameters are set.
Unfortunately the CGI breaks down even worse. Am I supposed to declare the variable like
Here is the Html from the form that is calling it as well. (random useless html has been removed)
Which also brings me to a secondary question along similar lines....
We are trying to send variables this way in both html and Javascript.
neither one goes through right
Are we naming improperly? Are we supposed to plug the variables in as different way such as
Does a URL and variables sent from Javascript need any special consideration for the server to understand it and grab them?
Oh, and just fyi, we are using a cgidev2 system with an AS400. But I can't imagine it being that radically different.
Thank you for any help that can be given
(just a warning this has been cross-posted)
Here is the issue, I have a form that sends to a different action based on the button pushed. But it also is sending variables to the server as well.
Here is the JS:
Code:
function validAdd() { var f = document.forms[0]; var error='N'; for (i = 0; i < qtyfield.length; i++) { if (!validate(qtyfield[i],i)){ alert('The quantity for item '+f[itmfield[i]].value+ ' should be in multiple of ' + f[minqty[i]].value); var error = 'Y' break; } } if (error != 'Y'){ f.action='/cgi-bin/SORCP002?ADD'; f.submit(); } } function validUpd() { var f = document.forms[0]; f.action='/cgi-bin/SORCP002?UPD'; f.submit(); }
Instead we are trying to do something more like
Code:
function validUpd() { var f = document.forms[0]; f.action='/cgi-bin/SORCP002?p_action=UPD'; f.submit(); }
Unfortunately the CGI breaks down even worse. Am I supposed to declare the variable like
Code:
var p_action=""
Code:
<FORM METHOD="POST"> <td class="orderpadmaint" height="30" align="center" width="20%"><a href="/cgi-bin/PQRCP010?p_wbcsqno=/%pq$_wbcsqno%/&p_sortmode=/%pq$_sortmode%/&p_curpage=/%pq$_pageno%/" target="_blank">Add Items from MAIN</a></td> <INPUT TYPE="HIDDEN" NAME="dummyfield"> <INPUT TYPE="HIDDEN" NAME="pq%_wbcsqno" value="/%pq$_wbcsqno%/"> <INPUT TYPE="HIDDEN" NAME="pq%_sortmode" value="/%pq$_sortmode%/"> <INPUT TYPE="HIDDEN" NAME="pq%_curpageno" value="/%pq$_curpageno%/"> <INPUT TYPE="HIDDEN" NAME="pq%_pageno" value="/%pq$_pageno%/"> <INPUT TYPE="HIDDEN" NAME="pq%_flrpageno" value="/%pq$_flrpageno%/"> <INPUT TYPE="HIDDEN" NAME="pq%_totlines" value="/%pq$_totlines%/"> <td Align="left"><A href="#" onClick="validAdd(); return false;"><IMG border="0" src="/_images/gen/ews_nav_qaddquotecart.jpg" width="186" height="27"></A></td> <td Align="right"><A href="#" onClick="validUpd(); return false;"><IMG border="0" src="/_images/gen/ews_nav_qupdateorderpad.jpg" width="186" height="27"></A></td> <A href="/cgi-bin/PQRCP005?p_wbcsqno=/%pq$_wbcsqno%/&p_sortmode=/%pq$_sortmode%/&p_curpage=/%pq$_pageno%/">/%pq$_pageno%/</A> <INPUT TYPE="HIDDEN" VALUE="/%pq$_itemno%/" NAME="pq%_itemno/%pq$_lineno%/">/%pq$_wbitmlnk%/ <A href="/cgi-bin/PQRCP005?p_wbcsqno=/%pq$_wbcsqno%/&p_sortmode=/%pq$_sortmode%/&p_curpage=/%pq$_pageno%/">/%pq$_pageno%/</A> <A href="#" onClick="validAdd(); return false;"><IMG border="0" src="/_images/gen/ews_nav_qaddquotecart.jpg" width="186" height="27"></A></td> <td Align="right"><A href="#" onClick="validUpd(); return false;"><IMG border="0" src="/_images/gen/ews_nav_qupdateorderpad.jpg" width="186" height="27"></A></td> </form>
Code:
<A href="/cgi-bin/PQRCP005?p_wbcsqno=/%pq$_wbcsqno%/&p_sortmode=/%pq$_sortmode%/&p_curpage=/%pq$_pageno%/">/%pq$_pageno%/</A>
neither one goes through right
Are we naming improperly? Are we supposed to plug the variables in as different way such as
Code:
'p_wbcsqno='+/%pq$wbcsqno%/+'&p_sortmode.....
Oh, and just fyi, we are using a cgidev2 system with an AS400. But I can't imagine it being that radically different.
Thank you for any help that can be given
(just a warning this has been cross-posted)
Comment