TannerCarter Posted January 13, 2012 Report Share Posted January 13, 2012 I took my js directly from forum site and I can't seem to make it work. My alert does not work either. The two fields I am concatenating are both regular dropdowns (not cascading). The field I want to update them to is not display only - it is text. All of my field names are entered correctly. Here is my script. Very straightforward. I got this to work on my input form, just can't get it to work on the update form. Any help would be appreciated. function concatenate() { var position1 = document.getElementById("EditRecordHauler").value; var position2 = document.getElementById("EditRecordDestination").value; var allpositions = position1+"|"+position2; document.getElementById("EditRecordHaulerDestination").value = allpositions; alert('all positions='+allpositions); } document.getElementById("caspioform").onsubmit=concatenate; Quote Link to comment Share on other sites More sharing options...
MayMusic Posted January 13, 2012 Report Share Posted January 13, 2012 Try this: function concatenate() { var position1 = document.getElementById("EditRecordHauler").options[document.getElementById("EditRecordHauler").selectedIndex].value; var position2 = document.getElementById("EditRecordDestination").options[document.getElementById("EditRecordDestination").selectedIndex].value; var allpositions = position1+"|"+position2; document.getElementById("EditRecordHaulerDestination").value = allpositions; alert('all positions='+allpositions); } document.getElementById("caspioform").onsubmit=concatenate; Please let me know if it works for you. Cheers :wink: :wink: :wink: Quote Link to comment Share on other sites More sharing options...
TannerCarter Posted January 13, 2012 Author Report Share Posted January 13, 2012 I just tried it with those changes and still no luck. Still not receiving the alert either. Really stumped on this one... Any other ideas? Quote Link to comment Share on other sites More sharing options...
bahar_vm Posted January 13, 2012 Report Share Posted January 13, 2012 If you don't even get the alert working it means there are broken codes prior to the alert line, when browser get to the broken code it stops rendering and compiling the rest. I suggest if you start debugging the code by having the alert command at the beginning of the script, if it does not work then other part of your page has broken codes. You can use Firefox add-on called Firebug for the debug purpose. Keep us updated. You may also provide the URL, I can take a look. Best, Bahar M. Quote Link to comment Share on other sites More sharing options...
TannerCarter Posted January 14, 2012 Author Report Share Posted January 14, 2012 If you could take a look, that would be great. https://b4.caspio.com/dp.asp?AppKey=e29 ... 2142c0a61b Quote Link to comment Share on other sites More sharing options...
TannerCarter Posted January 14, 2012 Author Report Share Posted January 14, 2012 By moving the alert statement up and working my way down I was able to get it to work with trial and error. It turns out that I needed to use getElementsByName for both of the dropdowns. I was thinking that syntax was only needed for cascading dropdowns. Anyway...I got it and here is the code. function concatenate() { var position1 = document.getElementsByName("EditRecordHauler")[0].value; var position2 = document.getElementsByName("EditRecordDestination")[0].value; var allpositions = position1+" | "+position2; document.getElementById("EditRecordHaulerDestination").value = allpositions; } document.getElementById("caspioform").onsubmit=concatenate; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.