Highlighted

If then else endif statement

Avatar

Guest

04-11-2008

I am trying very hard to get the information selected in a dropdown box and then put it in a text box. Can someone verify why this will not work? I am using FormCalc but have tried JavaScript as well with problems...Help!



if (SelectNewChangeDropdown.rawValue == "Pay To") then

CustomerForEmail.rawValue = PayToCustomerName

else CustomerForEmail.rawValue = ""

endif



if (SelectNewChangeDropdown.rawValue == "Ship To") then

CustomerForEmail.rawValue = ShipToCustomerName

else CustomerForEmail.rawValue = ""

endif



if (SelectNewChangeDropdown.rawValue == "Bill To") then

CustomerForEmail.rawValue = BillToCustomerName

else CustomerForEmail.rawValue = ""

endif



if (SelectNewChangeDropdown.rawValue == "Sold To") then

CustomerForEmail.rawValue = SoldToCustomerName

else CustomerForEmail.rawValue = ""

endif



Thanks.

Veleta

Replies

Highlighted

pguerett

04-11-2008

You are mixing javascript and formCalc ...stick with Javascript (there are more resources on the web that will show you how to do things). So your code as Javascript shoudl look like this:



if (SelectNewChangeDropdown.rawValue == "Pay To") {

CustomerForEmail.rawValue = PayToCustomerName

} else {

CustomerForEmail.rawValue = ""

}



if (SelectNewChangeDropdown.rawValue == "Ship To"){

CustomerForEmail.rawValue = ShipToCustomerName

} else {

CustomerForEmail.rawValue = ""

}



if (SelectNewChangeDropdown.rawValue == "Bill To") {

CustomerForEmail.rawValue = BillToCustomerName

} else {

CustomerForEmail.rawValue = ""

}



if (SelectNewChangeDropdown.rawValue == "Sold To"){

CustomerForEmail.rawValue = SoldToCustomerName

} else {

CustomerForEmail.rawValue = ""

}
Highlighted

Avatar

Guest

05-11-2008

Thanks, Paul...however, I am still having problems. CustomerForEmail shows "null". I want this information to go by email, so I am using a submit button as well with the following code:



xfa.resolveNode("Button1.#event").submit.target = "mailto:somename@somewhere.com?subject=New/Change " + SelectNewChangeDropdown.rawValue + "&body=Queue: " + "IMIMD-Customer_Master" + "\nPriority: 50" + "\nCategory: New/Change " + SelectNewChangeDropdown.rawValue + "\nCustomer Name: " + CustomerForEmail.rawValue;



I then created a variable for CustomerForEmail and thought that would help, but it didn't.



How do I get the information from the pull down to target the selected field and put that information in my email (customer's name) from a choice of at least 4 different fields.



Thx.

Vee
Highlighted

pguerett

05-11-2008

My guess is that the condition you are testing is not what you think it is. Add an app.alert(SelectNewChangeDropdown.rawValue) as the 1st statement. This will tell you what the value is before you test it. Also what event and object are you running that code on?
Highlighted

Avatar

Guest

05-11-2008

I am using a dropdown list with 4 options using Javascript and a textbox to put the customer name (shipping, payer, billing, sold to) depending on which one is selected from dropdown. I then put the customer information into my email submit button.



CurrentValue.rawValue = xfa.event.newText;



if (SelectNewChangeDropdown.value == 4) {

CustomerForEmail.rawValue = "testing1111"

}else {

CustomerForEmail.rawValue = "testing"

}



When I test this (all done on the change event for the drop down list) the CurrentValue textbox tells me what is being tested. Now it only runs "else" code and always brings in "testing", never "testing1111".



This is so strange to me, why it won't work.



Is it possible to send the form so you can take a quick look?



Vee
Highlighted

Avatar

Guest

05-11-2008

Paul, you are a genius!



However, I was able to use FormCalc, as I could not get it to work with JavaScript for some reason, but very pleased that it worked.



if (SelectNewChangeDropdown.rawValue == "Pay To") then

CustomerForEmail.rawValue = PayToCustomerName.rawValue

elseif (SelectNewChangeDropdown.rawValue == "Bill To") then

CustomerForEmail.rawValue = BillToCustomerName.rawValue

elseif (SelectNewChangeDropdown.rawValue == "Ship To") then

CustomerForEmail.rawValue = ShipToCustomerName.rawValue

elseif (SelectNewChangeDropdown.rawValue == "Sold To") then

CustomerForEmail.rawValue = SoldToCustomerName.rawValue

else CustomerForEmail.rawValue = ""

endif





Vee