JavaScript function to exchange the values of two text entry fields

Hello

I am a beginner APEX with the first application of the APEX. This app has a 22 page to enter data for a graph edge. There are two P22_LINK_NODE_A, P22_LINK_NODE_B text input fields.
Sometimes it is necessary to toggle (swap) the values of these two areas.
To do this, I added a button 'toggle_A_B' HTML and a Javascript function.

But... it does what it is supposed to make :(
By clicking on the button seems to send the page to the server, although this should not be the case... and the values of the fields P22_LINK_NODE_A, P22_LINK_NODE_B do not change.

I didn't expect that everything goes right on the client side.
Is it normal that the browser is trying to send the page?
Do I need to implement something on the side Server? (process, branches,...)


The "toggle_A_B" a button attribute HTML button: onclick = "toggleNodes (); »
Redirect Optioanl of the button is set to "no target". (behavior is the same with "redirecting to page 22")

In the "HTML Header" page, there is the following Javascript function (which works find in a non-Oracle-APEX HTML page).

< script type = "text/javascript" language = "JavaScript" >
function toggleNodes() {}
var x = document.getElementById("P22_LINK_NODE_A").value;
var y = document.getElementById("P22_LINK_NODE_B").value;
document.getElementById("P22_LINK_NODE_B").value = x;
document.getElementById("P22_LINK_NODE_A").value = y;
}
< /script >



There is a post on the forum with a similar topic, maybe I should also use this approach to ($s)?

Changing a value of the element in Javascript

Kind regards
Roman

Roman:

Set the target URL of the Html button

JavaScript:toggleNodes();

CITY

Tags: Database

Similar Questions

  • Changing the position of the cursor in a text entry field and remove digital zeros

    Flash8 - AS2

    It's good to be back after all these years and thank you for the people of faithfull as kglad, Ned Murphy, Rothrock and all others who give much of themselves to succeed this forum!

    My problem:

    I have a text entry field that is named in the box of properties like 'numberOfKids '.

    When the program is run, and a DELETE or BACKSPACE is pressed input textfield turns off

    and all the calculations that use the "numberOfKids" shows NaN.

    I got trapped in NaN and indefinite so that a digital 0 appears instead of a white one.

    There are two problems:

    First problem:

    The cursor to the left of zero, so the first number entered by the user is 10 x larger than what they want.  0 becomes 10.

    Question: How can I get the cursor to the right of 0?

    Second problem:

    When I manually move the cursor to the right of 0 and a number of entry, let's say 4, it appears like 04.

    Question 2: How to remove the zero digital in input textfield?

    Thanks for the help.

    Here is the code I use:

    calculateChildWeight = function () {}
    If (isNaN (numberOfKids)) {}
    numberOfKids = 0;
    }
    If ((numberOfKids) == undefined) {}
    numberOfKids = 0;
    }
    If (numberOfKids > = 0 & & numberOfKids < = 137) {}
    numberOfKids = numberOfKids;
    } else {}
    numberOfKids = 0;
    }
    If (isNaN (adjustedChildWeight)) {}
    adjustedChildWeight = 0;
    }
    If ((adjustedChildWeight) = undefined) {}
    adjustedChildWeight = 0;
    }
    adjustedChildWeight = Number (numberOfKids *(-100));
    numberOfKids.setSelection (numberOfKids.length, numberOfKids.length);
    If (numberOfKids.length = 2 & & numberOfKids < 10) {}
    remove the first character or no leading zeros
    numberOfKids = numberOfKids;
    // }
    };

    More important answer first: you get two helpfuls and one correct answer per thread. I think that once you give a specific answer a useful, you can't give the same answer. But I don't know.

    First of all, make sure that none of these text fields have a property of vars set.

    Also, you don't need to do it in two steps: revisedValue =-100 * parseInt (numberOfKids.text)

    As you read the value of your textfields of entry by using the text property, you also assign the value of the more dynamic by using the text property. That's what you do, right?

  • validate the value of a text input field

    Hi I am new to the Animate edge, and I worked on a project that requires text input. The code does not "recognize" the value entered in the input field. The action is quite straightforward, good answer (360) game label 02, wrong answer play label 03. Ideally, I'd like to allow three attempts.  I don't have a lot of experience in JavaScript, this piece of code are pieces that I put in place of tutorial and a little help.  Thank you and I appreciate all the help!

    var answer = sym.$("answer");

    Answer.html ("answer 1");

    inputAnswer = $('<input_/>').attr ({'type': 'text', 'value': ", 'id': 'reply'});

    inputAnswer .css ('font-size', 14);

    inputAnswer .css ("width", 150);

    inputAnswer .css ("background-color", "#ffffff");

    inputAnswer .appendTo (answer);

    var submitBtn = sym.$("btn");

    function checkAnswer() {}

    var rightAnswer = inputAnswer.attr ('value');

    If (rightAnswer is "360")

    {

    SYM. Play("02");

    }

    on the other

    {

    SYM. Play("03");

    }

    Returns false;

    }

    {submitBtn.click (function ()}

    checkAnswer();

    });

    q.jpg

    Hello

    Try to use the following syntax to get the value of the input text field.

    var rightAnswer = inputAnswer.val (); rather than access the .attr ('value')

    Have attached a simple example. Currently, it shows the correct/incorrect value in the console log.

    Thank you and best regards,

    Roger Simon

  • How to create the javaScript function that erases the text of the field values

    Hello
    How can I create a javaScript function to clear the values of the text fields
    and I want to call this function on the clear button on my custom area

    Yes it is possible but not recommended approach.

    Here is the link that you can use if you want to implement using javascript
    http://www.itechies.NET/tutorials/JScript/jsexample.php-PID-set_field.htm

    Thank you
    AJ

  • get the value of two fields in a field

    Hellou,

    I need some new help with javascript

    Currently I use the below code to get the value of one field to another:

    getField("Text35").value = getField("Text1").valueAsString;

    Now, I wonder how to change this code, so I could get the values of two fields in one. I for example field 'Name' and 'name' field, now I want to show in the field 'name '.

    Example, if the firstname field have John value and the value of the lastname field is Doe, I want to show in the field name as "John Doe".

    I hope that u understand what I want

    Thank you for helping me!

    getField("Text35").value = getField("Text1").valueAsString + "" +.

    getField("Text2").valueAsString;

  • Starting from two data tables, how do you get the values in two columns using values in a column (values get col. If col. A is not null values and get the pass. B if col. A is null)?

    Two tables provided, how you retrieve the values in two columns using values in a column (the pass get values. If col. A is not null values and get the pass. B if col. A is null)?

    Guessing

    Select nvl (x.col_a, y.col_b) the_column

    from table_1 x,.

    table_2 y

    where x.pk = y.pk

    Concerning

    Etbin

  • Mathmatical function to return the value in injectors

    Hello
    I have obliged. If value for ex Lake 4400000, he should return as 4.4millions even for billions.
    is there an oracle function to return the value in this format. ???

    Hello

    When I want to have a "readable" released in large numbers, I use to do the following:

    Scott@my11g SQL>with t as (
      2  select 3456123456 n from dual
      3  union all select 4567123 from dual
      4  union all select 123465 from dual
      5  )
      6  select n, case when n>1000000000 then trunc(n/1000000000,1)||' Billions'
      7  when n>1000000 then trunc(n/1000000,1)||' Millions'
      8  else to_char(n) end fmtn
      9  from t ;
    
             N FMTN
    ---------- -------------------------------------------------
    3456123456 3.4 Billions
       4567123 4.5 Millions
        123465 123465
    

    ------
    * + [change] + *.
    Moreover, lakh [url http://en.wikipedia.org/wiki/Lakh] has no meaning outside of South Asia.
    Especially for a French man like me, grown with [url http://en.wikipedia.org/wiki/International_System_of_Units] International system of units that is fighting against what I call "funky" measures empirical such miles, yards, feet, inches, just not multiple of 10³
    Same billion mean differ depending on the country (see [url http://en.wikipedia.org/wiki/Long_and_short_scales] long and short scales)

    Just for "fun": [url http://articles.cnn.com/1999-09-30/tech/9909_30_mars.metric.02_1_climate-orbiter-spacecraft-team-metric-system?_s=PM:TECH] this is what can happen when we do not use the same system of units.

  • How to calculate the sum of two digital form fields based on the selection of the checkbox.

    I have a form in Acrobat Pro who needs a custom calculation. How to calculate the sum of two digital form fields based on a selection of the checkbox. I have three number fields. Field-A and B are simple one or two digits. Field-C is the sum, or the total field. I want to field-C have a control box which, when turned on and off, just gives a. gives the sum of A + B

    _ Field - 2

    _ Field - A 4

    [check] _ _ field - 6 C

    [disabled] _ _ field - 2 C

    Thank you

    The custom field C calculation script could be:

    (function () {
    
        // Get the values of the text fields, as numbers
        var v1 = +getField("A").value;
        var v2 = +getField("B").value;
    
        // Set this field's value based on the state of the check box named "CB"
        if (getField("CB").value !== "Off") {
            event.value = v1 + v2;
        } else {
            event.value = v1;
        }
    
    })();
    

    Replace 'A', 'B', and 'CB' with the real names of the fields.

  • Check the boxes based on the value in a text field

    Hello.

    I'm building a pdf form in Acrobat Professional X. I want to add JavaScript to two checkboxs to achieve the following objectives:

    If the value of a text field (TLigne) is equal to 61, 64, 66 or 67, the first box (PlanACheck) has the value of the object of an audit.  If the value of a text field (TLigne) is equal to 60, 62 or 63, the second box (PlanBCheck) has the value of the object of an audit.

    I have no other than copy and paste Javascript experience, so I'm not sure I use the right language to research. If anyone can provide guidance, I would be very happy.

    Thank you very much!

    Usually this kind of thing will run the custom calculation of the target field script, but the boxes is not a calculation script, so we'll use the text for field Validation script do, with this code:

    this.getField("PlanACheck").checkThisBox (0, (event.value == "61" | event.value == "64" | event.value == '66' | event.value == "67"));

    this.getField("PlanBCheck").checkThisBox (0, (event.value == "60" | event.value == "62" | event.value == "63"));

  • Referring to the value of a text field, not the legend

    How to refer to the value in a text field to make the data entered by the user "BOLD" / no fat without the caption of a field text in bold or not bold?

    Hello

    Two lines should do. The first turn the caption and the "BOLD" value, then the second changes the legend of back to normal:

    TextField1.font.weight = "bold";
    TextField1.caption.font.weight = "normal";
    

    Hope that helps,

    Niall

    Ensure the dynamics

  • What is the value of a registry entry "PromptRunasInstalNetPath" Windows for?

    What is the value of a registry entry "PromptRunasInstalNetPath" Windows for?

    [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies]

    "PromptRunasInstalNetPath" = DWORD: 00000001; Guest ' run as ' install Net way -?

    It is not yet in the "WindowsServer2008R2andWindows7GroupPolicySettings.xlsx" Microsoft Excel spreadsheet Data-Base; so that is it for exactly?

    Ditto for the following RegEntries 3:

    [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Network]

    "NoWorkgroupContents" = DWORD: 00000000. No content of working group -?

    "NoFileSharing" = DWORD: 00000001; No file - sharing?

    "NoPrintSharing" = DWORD: 00000001; No print sharing -?

    JPD

    Hi JPD.

    Thank you for visiting the Community Forums of Microsoft.

    We don't have enough resources to provide a good explanation for this query. It is better suited for the professionals on the TechNet Forums. So, please post your question on the Forums Pro TechNet Windows 8 IT from this link:

    http://social.technet.Microsoft.com/forums/Windows/en-us/home?category=w8itpro

    Hope this information is useful.

  • How to recover the dynamic value of ADF text entry?

    Hello

    I'm developing an application where this scenario occurs.

    1. a dynamic text input for the click on the radio button, must be created.  (I am able to do this).

    2. I am entering a value in dynamic text that is created at run time.

    How to get the value of dynamic text in my java code?

    Or what property must be used to retrieve dynamic data of text entry?

    Hello

    Here is a case that as it is similarly instead of your box here a commandbutton control.

    JSPX code

    actionListener="#{viewScope.Mbean.ActionLis}"/ >

    track 1:

    1. here you using "setValueChangeListener".

    2. with the help of MethodBinding to invoke the listener in the same class itself.

    3 MethodBinding and el class has been deprecated in this approach.

    the bean code

    Import javax.faces.context.FacesContext;

    Import javax.faces.el.MethodBinding;

    Import javax.faces.event.ActionEvent;

    Import javax.faces.event.ValueChangeEvent;

    Import javax.faces.event.ValueChangeListener;

    Import oracle.adf.view.rich.component.rich.input.RichInputText;

    Import oracle.adf.view.rich.component.rich.layout.RichPanelBox;

    Import oracle.adf.view.rich.component.rich.nav.RichCommandButton;

    Import oracle.adf.view.rich.context.AdfFacesContext;

    public void ActionLis (ActionEvent actionEvent) {}

    Add the code in the event here...

    RichInputText rt = new RichInputText();

    rt.setAutoSubmit (true);

    Class parms [] = new class [] {ValueChangeEvent.class};

    MethodBinding mbind = FacesContext.getCurrentInstance () .getApplication () .createMethodBinding ("#{viewScope.Mbean.valuchnglis}", parms);

    rt.setValueChangeListener (mbind);

    ((RichCommandButton) actionEvent.getSource ()) .getParent () .getChildren () .add (rt);

    AdfFacesContext.getCurrentInstance () .addPartialTarget (((RichCommandButton) actionEvent.getSource ()) .getParent ());

    }

    {} public void valuchnglis (ValueChangeEvent valueChangeEvent)

    System.out.println ("value" + valueChangeEvent.getNewValue ());

    }

    Track 2:

    1. here you using "addValueChangeListener".

    2. you need an additional class to do so.

    3. you can retrieve the value of processValueChange.

    the bean code

    Import javax.faces.context.FacesContext;

    Import javax.faces.el.MethodBinding;

    Import javax.faces.event.ActionEvent;

    Import javax.faces.event.ValueChangeEvent;

    Import javax.faces.event.ValueChangeListener;

    Import oracle.adf.view.rich.component.rich.input.RichInputText;

    Import oracle.adf.view.rich.component.rich.layout.RichPanelBox;

    Import oracle.adf.view.rich.component.rich.nav.RichCommandButton;

    Import oracle.adf.view.rich.context.AdfFacesContext;

    public void ActionLis (ActionEvent actionEvent) {}

    Add the code in the event here...

    RichInputText rt = new RichInputText();

    rt.setAutoSubmit (true);

    rt.addValueChangeListener (new vc());

    ((RichCommandButton) actionEvent.getSource ()) .getParent () .getChildren () .add (rt);

    AdfFacesContext.getCurrentInstance () .addPartialTarget (((RichCommandButton) actionEvent.getSource ()) .getParent ());

    }

    Import javax.faces.event.ValueChangeEvent;

    Import javax.faces.event.ValueChangeListener;

    public class vc implements {ValueChangeListener

    public void processValueChange (ValueChangeEvent valueChangeEvent)

    {

    System.out.println ("value of the class" + valueChangeEvent.getNewValue ());

    }

    }

    Thank you

  • Setting a different value to a text entry in the table of the adf conditionally

    Hi guys

    I work in Colombia - British ADF and ADF Faces.I have a table of adf upadable in which a text input is there in every page row.when is loading the input text is filled with-1 (i.e., the value of one of my columns in a table in the database). My goal is to make this entry blank when text the value retrieved is - 1 for this line. Entering text except-1 data will remain as it is.

    We set the value of this text of entry through inputtext2.setValue("") conditionally to the support of this page bean. But even if a given line is - 1, it contains the definition of the data of all the empty lines.

    Can anyone suggest me how to do this please?

    Put a transient attribute in your view object and use that one instead of the actual column.

    In the accessor get for the transient, did return null if the value of the real column is - 1

    In the setter, just delegate to the true Set accessor.

    John

  • How to get the values of two points separated in Javascript checkbox

    Hello

    I want to get the values of an element of the checkbox as a form of separted from the colon as what we get in the database. For example '10:11:12 '.

    When I tried to write a code like this it does not work. Please tell me where I'm wrong.


    function getValues (pcheckbox) {}
    cb_name = html_GetElement(pcheckbox+'_0').name;
    cb_array = document.getElementByName (cb_name);
    var val_str =': ';
    for (i = 0; i < cb_array.length; i ++)
    {
    If (cb_arraychecked)
    {
    val_str += cb_array [i] .value + ':';
    }
    }
    html_GetElement (P206_TEXT) .value = val_str;
    }



    I try to call the function getValues ('P206_CHECK');

    Thank you and best regards,
    Vikas Krishna

    Hi Vikas,

    Try this-

    (1) create a checkbox element called PI_CHK
    (2) in the Option of the attributes of the form element, type onclick = "getValues () '"
    (3) create a named text field point PI_TEXT

    Enter the HTML of the Page Header Section

    
    

    Concerning

    Paul

  • ADF - JavaScript getValue is not recovering the value of output text

    Hello.

    I have a workflow with fragments, before the page loads, I call a function in my Bean, function to set initial values.

    In my grain I have variables like this:

    private String var1;

    public void setVar1 (String var1) {}

    This. var1 = var1;

    }

    public String getVar1() {}

    return var1;

    }

    According to a request, I put this variables.

    On my page, I have several panel grid layouts, with the cells in the grid that contains an af:link and an af:outputText.

    My af:link get the icon property with the help of the variables set before the loading of the page, like this:

    /Dir1/Dir2/#{MyBean.var1}.jpg

    A my the same output text:

    value: #{MyBean.var1}

    It works perfectly.

    What I need is to valorise tha in the output through a JavaScript function text.

    Inside the af: link, I have a clientListener that calls a JavaScript function where I need to get this value, something like this:

    function testValue (actionEvent) {}

    actionEvent.cancel ();

    source var = actionEvent.getSource ();

    var value = source.findComponent ("c1");

    var value= currentValue. getValue();

    Alert ("currentValue:" + currentValue);

    }

    The value is never shown. I also tried withAdfPage.PAGE.findComponent

    Its curious, because I do the same with a seizure of text on the page, have not the value of a Bean and the value was fine.

    I don't understand what is happening.

    Could you help me?

    Thanks in advance.

    I solved it.

    I've been away a property: ClientComponent: true.

    Thank you.

Maybe you are looking for