INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Struts question: Problem changing the action and submitting the page using javacript

Struts question: Problem changing the action and submitting the page using javacript

Struts question: Problem changing the action and submitting the page using javacript

(OP)
I have a form that has an action. I am trying to redirect the page to another action using javascript after setting some cookies.
My question is will the struts-config.xml action always be in control even though you are trying to change action and submit it using javascript.

I get to here alert("first try made it here "); but I never get the following to happen. It just stope.

frm.action = "acms/int/intakeHistory.do?function=getInt";
frm.submit();

Is there something that I am missing.


JAVASCRIPT
if (cookie == null){
deleteCookie("JSUBJECTID");
setCookie ("JSUBJECTID", value, null, "/");
alert("first try made it here ");
frm.action = "acms/int/intakeHistory.do?function=getInt";
frm.submit();
alert("dam I am here");



ACTION
<action path="/getassignsum"
type="com.test.web.struts.int.IntAssignummaryAction"
name="IntAssignummaryActionForm"
validate="false"
input="/assignmentsum.do"
scope="request">
<forward name="success" path="/assignmentsum.do"/>
<forward name="accessdenied" path="/toregistry.do?prefix=&amp;page=/accessdenied.do"/>
</action>

FORM
<html:javascript formName="IntAssignummaryActionForm"/>
<script language="JavaScript">

window.onload = function()
{
setInputFocus("fromDateAsString");
}
</script>
<script language="JavaScript">


function isSubjectConsolidated(consolidatedToPDJ)
{


if(consolidatedToPDJ != 'N/A')
{
var msg='This minor has been consolidated with '+ consolidatedToPDJ +'. Please search for this minor under '+ consolidatedToPDJ;
alert(msg);
return true;
}
return false;
}


function setSubjectId (value,consolidatedToPDJ)
{

if(isSubjectConsolidated(consolidatedToPDJ))
{

return false;
}

var cookie = getCookie("GETSUBJECTID");

if (cookie == null){
deleteCookie("JSUBJECTID");
setCookie ("JSUBJECTID", value, null, "/");
alert("first try made it here ");
frm.action = "acms/int/intakeHistory.do?function=getInt";
frm.submit();
alert("dam I am here");
}
else
{
setCookie ("COMPANIONSUBJECTID", value, null, "/");
}
alert("made it here ");
/* return true; */
frm.action = "acms/int/intakeHistory.do?function=getInt";
frm.submit();
alert("what happen. I am suppose to be gone");
}

function getSubjectId ()
{
return getCookie ("JSUBJECTID");
}

function deleteSubjectId ()
{
deleteCookie ("JSUBJECTID");
}


</script>

<c:set var="SCREEN_TITLE" value="Intake Assignment Summary" scope="request"/>
<html:form action="/getassignsum.do">

Howard

RE: Struts question: Problem changing the action and submitting the page using javacript

(OP)
The above work when I change used document.formname.action and document.formname.submit instead of frm.action and frm.submit.

I tested it with a hardcoded action. Now I want to pass in the action but need to know how do I
concatenate " with the action.

Meaning I want to see "acms/int/intakeHistory.do?function=getInt"

Not sure how to add "

I tried

String iLink = """ + LINK + """;

but this did not work


Howard

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close