473,397 Members | 1,985 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Need help passing a value from an HTML form.

11
I have this code which imports a file depending on user's selection (3 radio buttons romaji, hiragana,kanji)
The way it is now, checkImport() returns the last option (from handlers) no matter which button is selected. What changes Do I have to do the Javascript to activate the 3 selections? Any help will be greatly appreciated. Cheers!
Expand|Select|Wrap|Line Numbers
  1.     whichlang = "English"
  2.     def checkImport():
  3.         if UserLogin.whichlang == "Hiragana":         sys.path.append(os.path.join(config.APP_ROOT_DIR, 'srcHiragana'))
  4.             return __import__('conjugateNew')
  5.         elif UserLogin.whichlang == "Kanji":            sys.path.append(os.path.join(config.APP_ROOT_DIR, 'srcKanji'))
  6.             return __import__('conjugateNew')
  7.         elif UserLogin.whichlang == "Romaji":            sys.path.append(os.path.join(config.APP_ROOT_DIR, 'srcRomaji'))
  8.             return __import__('conjugateNew')
  9.         else :#whichlang == "English":           sys.path.append(os.path.join(config.APP_ROOT_DIR, 'handlers'))
  10.             return __import__('conjugateNew')
  11.  
  12.  
Html code
Expand|Select|Wrap|Line Numbers
  1.     <div id="Layer-5" class="_text editable"  >
  2.         <input type="radio" name="langgroup" value="Romaji"checked> Romaji
  3.         <input type="radio" name="langgroup" value="Hiragana" checked> Hiragana
  4.         <input type="radio" name="langgroup" value="Kanji"checked> Kanji
  5.     </div>
  6.  
Javascrip code
Expand|Select|Wrap|Line Numbers
  1. <script>
  2. $(document).ready(function() {
  3.     var langgroup = "English"
  4.     $("input[name='langgroup']").live("change", function() {
  5.       //alert($(this).val());
  6.       langgroup = $(this).val();
  7.     });
  8.      $('#play').click( load_alerts );
  9.     function load_alerts()    {
  10.         var url = "/trial";
  11.         data = {"whichlang":langgroup};
  12.         $.post( url, data, post_ack_handler );    }
  13.  
  14.     function post_ack_handler(data, textStatus, xmlObj){
  15.         $("div#trial").html(data);
  16.         if (textStatus == "error")
  17.             $('#showerror').html(xmlObj.responseText);    }    
  18. });
  19. </script>
  20.  
Jan 3 '11 #1
3 1184
Oralloy
988 Expert 512MB
2inshix,

It looks like you're starting in an incorrect state - all three radio buttons are set as "checked" in your HTML.

Try setting only one to "checked" to start with.

Luck!
Oralloy
Jan 3 '11 #2
2inshix
11
Hello, Oralloy,
Yes, you're s right! That was very silly of me wasn't it! (laughs)
That problem is solved, but there's a new issue. Once the selection is made, that selection remains persistant; meaning it won't allow a new button selection, even after a page refresh. Can you think of a quick fix just from what you see above?

Any suggestions would be greatly appreciated.

Cheers
Jan 3 '11 #3
Oralloy
988 Expert 512MB
I think your problem lies in the JavaScript bit
Expand|Select|Wrap|Line Numbers
  1. $("input[name='langgroup']").live("change", function() { 
  2.       //alert($(this).val()); 
  3.       langgroup = $(this).val(); 
  4.     }); 
You need to verify that the correct value is being used in the assignment.

Cheers!
Oralloy
Jan 3 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Ross McLoughlin | last post by:
Hey all, Is it possible to pass a html form to a vb component, where it can be further processed? Thanks Ross
1
by: Joe Ray | last post by:
I am interested in passing encrypted HTML form data to a JSP page where it is than decrypted. Can someone suggest a technique to do this and the technology or encryption method I should use. If you...
11
by: HolaGoogle | last post by:
Hi, Sorrryy to ask such basic question but i do need your help! Here's what i'm trying to do: In my parent form i'm calling a my Iframe form to get certain value, then depending on that value...
0
by: Phil | last post by:
okay, very simple detail.... I have an HTML form which one field is a type of "file". I am passing the value of this "file" input via a hidden form field to an aspx page. Can i save the file to...
2
by: Holger Butschek | last post by:
Hi folks, first of all, I'm absolutly new to javascript. I have designed a html-form and am trying to path parameters with the suffix of i.e. ?Seminartitel=hallowelt in the url. In the head...
1
by: rcmail14872 | last post by:
I used the upsize wizard to change my Access 2002 database to a SQL Server ADP project. I had a form where the user entered a value into a text box and when a command button on the form was...
0
by: bp_jobemail | last post by:
I'm trying to use PHP to wrap the output of an HTML form before it goes into a precompiled C cgi script. Essentially, the company that I work for uses a purchased precompiled c program for their...
2
by: =?Utf-8?B?Um95?= | last post by:
Hi all, In a form I have a text called myText as input and need to pass its value to the next page (mySecond.asp) The following works fine and my next page I get the value of myText=test: <a...
4
idsanjeev
by: idsanjeev | last post by:
SIR I AM PASSING VALUE FROM ONE FORM TO ANOTHER FORM THROUGH COOKIES BUT IS CAN ONLY TRANSFER LAST VALUE HOW CAN PASS VALUE AFTER CLICKIN ON LINK I AM USING THE CODE IS FOR LINK <td><a...
1
by: krus | last post by:
Hi All, I am relatively new to HTML and perl scripts. I am writing a HTML page which has a form. It takes two inputs. Now I want pass these two inputs from the HTML form to the perl script. I want...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.