textbox does not active by clicking on radio button

Sarah Salar

i have created two radio button to get value i.ee max it goes to same varibale total. i wanted to active only one textbox at a time. and accept value.

<dt>
            <dd>
        <input id="clicking"  data-dojo-type="dijit/form/RadioButton"  name="method" type="radio" value="clickarea" checked="false">
        <label for="clicking">By Clicking</label><br>
                   <input type="text" name="Name" data-dojo-type="dijit/form/TextBox"
                   data-dojo-props="trim:true, propercase:true" value="" id="Area1" disabled = "true" >
            </dd>
        </dt>
       <br></br>
       <dt>
           <dd>
       <input id="draw"  data-dojo-type="dijit/form/RadioButton" name="method" type="radio" value="drawarea" >
        <label for="draw">Draw Area</label><br>
         <input type="text" name="Name" data-dojo-type="dijit/form/TextBox"
                   data-dojo-props="trim:true, propercase:true" value="" id="Area2" disabled = "true"">
            </dd>
         </dt>


if (document.getElementById('clicking').checked) {
    document.getElementById('Area1').disabled = false;
    var container = dijit.byId("Area1");
    container.set("value", evt.graphic.attributes.Area_);
    area = container;
} else {
    document.getElementById('Area1').disabled = true;
}
if (document.getElementById('draw').checked) {
    document.getElementById('Area2').disabled = false;
    area = e.values;
    document.getElementById("Area2").value = area.toFixed(2);
} else {
    document.getElementById('Area2').disabled = true;
}
Vikash Pandey

there were some syntax error.

Check below working code-

<link rel="stylesheet" href="https://js.arcgis.com/3.20/dijit/themes/claro/claro.css">
    <link rel="stylesheet" href="https://js.arcgis.com/3.20/esri/css/esri.css">

    <script src="https://js.arcgis.com/3.20/">
    </script>
    
    <script>
    function enableDisableTextArea(){
if (document.getElementById('clicking').checked) {
    document.getElementById('Area1').disabled = false;
    var container = dijit.byId("Area1");
    //container.set("value", evt.graphic.attributes.Area_); // get this value first
    area = container;
} else {
    document.getElementById('Area1').disabled = true;
}
if (document.getElementById('draw').checked) {
    document.getElementById('Area2').disabled = false;
   // area = e.values; //need to get this value first
    //document.getElementById("Area2").value = area.toFixed(2);
} else {
    document.getElementById('Area2').disabled = true;
}
 
 }
    </script>
<dt>
            <dd>
        <input id="clicking"  data-dojo-type="dijit/form/RadioButton"  name="method" type="radio" value="clickarea" checked="false" onClick ="enableDisableTextArea()">
        <label for="clicking">By Clicking</label><br>
                   <input type="text" name="Name" data-dojo-type="dijit/form/TextBox"
                   data-dojo-props="trim:true, propercase:true" value="" id="Area1"  >
            </dd>
        </dt>
       <br></br>
       <dt>
           <dd>
       <input id="draw"  data-dojo-type="dijit/form/RadioButton" name="method" type="radio" value="drawarea" onClick ="enableDisableTextArea()">
        <label for="draw">Draw Area</label><br>
         <input type="text" name="Name" data-dojo-type="dijit/form/TextBox"
                   data-dojo-props="trim:true, propercase:true" value="" id="Area2" disabled = "true"">
            </dd>
         </dt>
         
         
         
         
         

Updated JSFiddle- https://jsfiddle.net/vikash2402/f2hxt25d/6/

Hoping this will help you :)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Not able to show the textbox after clicking radio button in primefaces

Radion button as image does not uncheck upon clicking other radio button

Clicking on a disabled radio button

Clicking on radio button

Textbox does not disable when I click the radio button

Radio button not clicking on single click

Clicking radio button Selenium/Python

How to `SendKeys` to the last active input TextBox after clicking a button in winforms (C#)?

Focusing on textBox after clicking a button

Textbox value in other textbox by clicking button not correct

Check if bootstrap radio button is active

Make button active after clicking other button

Display textbox/button on selection of radio button

problem in clicking radio button can't able to select a radio button

On clicking first radio button, automatically open radio button inside of that div

How do I make it so pressing Enter in a textbox does the same as clicking the button next to it?

HTML - custom radio button not toggled if clicking the text

How to select radio button by clicking its div?

Selecting a radio button when clicking an image

selenium - clicking on radio button generated by javascript

How to make a radio button unchecked by clicking it?

Enable <select> <option> after clicking radio button

Toggle HTML radio button by clicking its label

Executing radio button click upon clicking a link

Redirecting to a struts action on clicking on a radio button

how to check a radio button by clicking on a table row?

get the value of radio button by clicking on submit

Changing text when clicking radio button

clicking text should click the radio button in HTML