2 Replies - 1519 Views - Last Post: 01 March 2013 - 11:20 AM

#1 ScreamingTacoJeebus   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 01-March 13

Replacing Data in a Field (3 Form Application)

Posted 01 March 2013 - 10:28 AM

OK, I'm trying to do something within a 3 Page Active 4D form powered by Javascript, and it is this...

On page 1 a user selects a value from a pull down menu.

Page 2 is where all the functionality I need happens, and here is what I need to happen.

I have to use something along the lines of Getsession_Item to get the value from the pop up box compare it to a value entered within a text box in step, and compared to the 3 separate values in the pull down in step 1.

If the value of the pull down is larger than the amount in the text box than I need it to reduce the value using updateSession. I've written some code that I think should work, but for the life of me I cannot get it working, and firebug isn't detecting errors.

The data that goes and gets published in a review page.

$("#DeliveryMethod_T").click(function(){
    var Amount_T = getSessionItem("Amount_T");



var shortAdv = 0;
temp = $("#NetEC_R").val();
var netEarned = parseInt(temp.replace(/\,/g,''));

if(("#Amount_t").val()!=""){
    shortAdv = parseInt($("Amount_t").val());
    }
        if($("#Amount_t").val()> netEarned ){
     if (netEarned  >= 3000) {  
    Amount_t = 3000
} else if (netEarned  >= 2000){  
    Amount_t = 2000
    } else if (netEarned  >= 1000){  
    Amount_t = 1000

}

$("#Button_Continue").click(function(){
    updateSession('Amount_T', $("#Amount_T").val());
    window.location.href = "/step3.a4d"
    });

}



});



Is This A Good Question/Topic? 0
  • +

Replies To: Replacing Data in a Field (3 Form Application)

#2 andrewsw   User is offline

  • no more Mr Potato Head
  • member icon

Reputation: 6957
  • View blog
  • Posts: 28,696
  • Joined: 12-December 12

Re: Replacing Data in a Field (3 Form Application)

Posted 01 March 2013 - 11:13 AM

Couldn't follow your description but, if it helps, you have an error here:

$("Amount_t")
// should be
$("#Amount_t")


.. and JS code is semi-colon terminated. It is possible that these may be omitted but I would encourage you to use them.
Was This Post Helpful? 0
  • +
  • -

#3 JackOfAllTrades   User is offline

  • Saucy!
  • member icon

Reputation: 6260
  • View blog
  • Posts: 24,030
  • Joined: 23-August 08

Re: Replacing Data in a Field (3 Form Application)

Posted 01 March 2013 - 11:20 AM

Adn

if(("#Amount_t").val()!=""){


is missing the $

if($("#Amount_t").val()!=""){

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1