Setting the value of a textbox from another page

Hi Everyone,
I have a multi paged application (multiple xib, multiple controllers)
In my selection view, the view that holds the UIViewPicker control, I need to populate the page that called the selector page...
I have the code to identify what page called the selector, and when the page is dismissed, I need to fill in the field from the calling page.
I have included the header of the calling view in my selector view, and now I need to be able to fill in a readonly textbox in the calling view....
Do I need to setup a property for each of the textboxes in the calling view, or can I populate them directly??
thanks
tony

alt-088 wrote:
I am sorry, but I am lost in this implementation....
How exactly do I tell the self.parentViewController what control will receive the new text value??
Ooooops!! I'm the one who needs to be sorry, Tony:
// from previous post
- (void)setTextInParent:(NSString* textValue) {
// assume that every possible parent controller has a "textbox" object
// which is a member of some class that has a writable 'text' property
[previousViewController setValue:textValue forKey:@"text"]; // <-- * Idiot alert *
Looks like another one of my senior moments. As you pointed out, we need the value of the 'textBox' property before we can set the value of the 'text' property.
To your question on how I am displaying the second view, it is called via
[self presentModelViewController:screen animated:YES]
from a button click event
Cool. That means we already have the address of vc1 in the 'parentViewController' ivar of vc2, so we don't need to add the 'previousViewController' ivar shown in my example.
So here's a corrected and maybe more relevant example--this one has been tested (Duh!), btw:
- (IBAction)done {
// get the currently selected string
NSInteger row = [pickerView selectedRowInComponent:0];
NSString *selection = [dataArray objectAtIndex:row];
NSLog(@"%s: selection=%@", _func_, selection);
// set text in textBox property of parent controller
[self.parentViewController setValue:selection forKeyPath:@"textBox.text"];
[self dismissModalViewControllerAnimated:YES];
I have tried to implement this code
[self.parentViewController setValue:21 forKey:@"test"];
but it is generating an error stating
passing argument 1 of 'setValue:forKey:' makes pointer from integer without a cast
Yeah, referring to the doc, [setValue:forKey:|http://developer.apple.com/iphone/library/documentation/Cocoa /Reference/Foundation/Protocols/NSKeyValueCodingProtocol/Reference/Reference.html#//appleref/occ/instm/NSObject/setValue:forKey:] wants an id type (pointer to an object of any Obj-C class) for the first arg. Since 21 is an int, i.e. a scalar value, the compiler doesn't like it (and the runtime system would like it even less).
However when you want to use KVC to set a scalar property, the methods are actually smart enough to extract an int if you provide a NSNumber object (see "Setting Attribute Values Using Key-Value Coding" under [Key-Value Coding Fundamentals|http://developer.apple.com/iphone/library/documentation/Cocoa/Conc eptual/KeyValueCoding/Concepts/BasicPrinciples.html#//apple_ref/doc/uid/20002170 ] in the Key-Value Coding Programming Guide). So if 'test' is an int ivar of the parent controller, something like this should work:
[self.parentViewController setValue:[NSNumber numberWithInt:21] forKey:@"test"];
Does that cover your questions? Sorry again for the bad code. Most of the examples I post are pasted directly from working, tested code, and I usually add a disclaimer if it's just something I keyed into the forum. But when I"m having a senior moment all bets are off.
- Ray

Similar Messages

  • Set Default Value based on Field from another table for a custom object

    I'm trying to set the default value on a custom object field to the value of an account field. I have tried the syntax 50 different ways, and just am getting no where. The account field label displays as DBA, the integration tag is ltDBA_ACCT, and it shows up in reporting fx area as Account.Text_22.
    The custom object field I'm triying to update is also called DBA, which was originally the "NAME" required field. Does the table name, Account, have to be included? Do I need a function in front of the field?
    I have been updating the external ID using the row ID with syntex <ID> (Less than ID greater than) so I know it is possible to set the Default Value, but <DBA>, <ltDBA_ACCT>, "Account"."DBA", and so on just don't not work.
    If anyone knows how to enter this I'd really appreciate the help.

    Ok, so if you want to default a field to the value from another object, you have to use the JoinFieldValue function. I think you understand that, based on your original post, but I want to be sure that you do.
    Next, this will only work as a default if the record is created from the object that you wish to join on because a default works at record creation and the ID needs to be available for it to work properly. It will not work if you choose the related object record after the custom object record is created. You could set the value as a post-default, but that does not seem to meet your requirements.
    The syntax for the Default Value would be as follows: JoinFieldValue(ref_record_type, foreign_key, field_name).
    In your case, ref_record_type is '<Account>', foreign_key is &#91;<AccountId>&#93;, and field_name is '<YourFieldName>'. The best way to determine what the field name is would be to create a new workflow for Account and use the Workflow Rule Condition expression builder to pick your field ("DBA") from the list. The value that is returned by the expression builder should be placed in the field_name variable in the JoinFieldValue function (minus the brackets and in single quotes).
    Give this a shot and let me know how you do.
    Thom

  • Setting the value of a textbox which is created in a loop

    Hi all,
    I have two jsp pages. In page1, I have a table which has rows that are generated in a loop. something like this.
    <script type="text/javascript">
    function callMe(num)
    alert("from callme");
    var linkId = "link"+num;
    var boxId = "qotApprBy"+num;
    var input = document.getElementById(linkId);
    //alert(input.name);
    if(input.name==linkId)
    document.getElementById(boxId).value="<%= aName %>";
    else
    document.getElementById(boxId).value="General";
    <table width="100%">
    <%
    for(int i=0; i<myList.size(); i++)
    String myName = (String)myList.get(i);
    String linkId = "link"+(i+1);
    if(aName==null)
    aName=myName;
    String qotApprById = "qotApprBy"+(i+1);
    System.out.println("id:" + qotApprById);
    %>
    <tr>
    <td>
    <input name="<%= qotApprById %>" type="text" id="<%= qotApprById %>" value="<%= aName %>"><a id="<%=linkId%>" href="FAM_OsiCustomApproverSearch.jsp?qotSearchNo=<%=3167%>&qotSrhVersionNo=<%=1%>&rowId=<%=(i+1)%>" onclick="callMe(<%=(i+1) %>)">Click Me</a>
    <% aName=null; %>
    </td>
    </tr>
    <%
    %>
    </table>
    When ever I click the hyperlink it basically takes to another jsp page which submits its form values to page1. I need to get the value from page two & assign it to the corresponding textbox. Say, if I clicked on link in the 1st row of the table the value of the textbox in the first row of the table should change. If I click on the link in the second row of the table I need to change the value of the textbox in the second row and so on. My problem is even if I click the nth link in the nth row of the table, its changing the value of textbox in the 1st row. Can someone help me.

    can i see the the complete 2 jsp's

  • Setting the value of a textbox to be the display value of a selected item

    I have two seperate regions on the same page. In the top region I have a select list with submit and in the bottom region I have a textbox. I can get the value of the textbox to be set to the RETURN value of the select list, but it is merely a number. I would like for the value of the textbox to be set to the DISPLAY value of what the user has selected from the select list. How can I accomplish this?
    Thanks,
    BoilerUP

    Hi BoilerUP,
    Can’t you create an item based on a select, that returns the value you want?
    select text from mytable where id = :myselectlist_id;
    Regards Pete

  • Set the values of metadata properties from java

    Hi everybody,
    I created a metadata property "Category" in System Admin - System Config - KM - Global Services - Property Metadata.
    My requirements:
    When a user creates a document (upload or new txt file, etc.) in folder X the value of this metadata propery should also automatically be set to value X. So that the user doesn't need to set this value himself.
    This way we can have more reliability on the accuracy of the metadata of this field.
    Can anybody help me on how to set this property automatically in the screen for the creation of upload of a new file?
    Thanks
    Kind regards
    Wouter

    Hi Robert,
    It's been a while but I'm back
    We finally decided which way to go for this development (as it was on hold untill now) and we decided to go with the KM Repository service.
    I already started implementing this service and So far it reacts on the creation of new documents (CREATE_CHILD event).
    public void received(IEvent event)
       try{
           if(event instanceof IResourceEvent)
              IResourceEvent resevent = (IResourceEvent)event;
              switch(resevent.getType())
                 case ResourceEvent.CREATE_CHILD:
                         IResource res = resevent.getResource();
                         break;
    The resource (res) I get from the resourceEvent (resevent) is the parrent resource of the newly created resource. What I need is the newly created resoruce itself.
    Do you happen to know if there is an interface or method somewhere through which I can get access to this new resource?
    Otherwise the only way to do this would be to loop over the children of the parent folder and get the newest one. But this would just kill the performance as the folders keep on growing...

  • Can you set the value of a div from a select statment?

    Hi all
    I have a div that is used as Tool tips for a cell in a table, is there an easy way to set the text in that div to the result of a select statement?
    Appreciate the Help
    LT

    select ename, '<div '||style||'>'||htf.escape_sc(description)||'</div>' description
    from some_table
    was this what your asking. You need to not escape special characters so the div tag acts as HTML in your report. The data is escaped using a PL/SQL function.
    Is this what your asking?
    Mike

  • How to write a formula that includes the value of a cell from another external numbers file ?

    Hello,
    Maybe my Numbers is too old : Numbers '08 v 1.0.3
    But it doesn't seem to allow me to write a formula that includes the value of an external cell...
    Any answers ?
    Upgrading to Numbers '09 ?
    Thanks !

    Olivier,
    Be sure to Send Feedback to Apple using the Feedback tool in the Numbers menu. That will help the Numbers design team prioritize their feature requests for the next version.
    Jerry

  • How to set the value of a textbox to 0 "Zero" in a continues form footer while the detail of the form has not data

    I have a continues form in which I used the” if(), IsNumeric(), isnull and SUM ()” functions to calculate the total amount of the records if exist in the details, else return me 0 “Zero”:
    Iif(IsNumeric(Tr_Amount), SUM(Tr_Amount),0)
    Iif(isnull(Tr_Amount), sum(Tr_Amount),0)
    However, it’s not working fine. While it has no records in in details it doesn’t return 0 in the textbox, but if it has some records it returns the total amount.
    Please help!
    Thank you in advance! 

     if this involves the case of a continuous form where there are no records - and the field sits in the footer of the continuous form....
    you can put in code in the OnCurrent event of the form that checks for records and if no records then writes the 0 into the text field in the footer.  note that with this approach all the logic is here in the OnCurrent event as that field
    must be unbound with no formula in its control source - - meaning that when it sums, that sum code must also occur in the oncurrent
    the check for records can be a dcount of the record source
    since NZ isn't working maybe there is out there another method for this situation that can be put into the field's control as you have been attempting - maybe another responder will educate us both on that....something along the lines of a HasData for forms....but
    I don't know what that is off hand and so only suggest this method as a work around.... it should work fine.....

  • How to set the value in SelectManyChoice

    Hi,
    My problem is i m trying to set the value which is coming from the Iterator in select may choice as:
    DCIteratorBinding viewReportIter = getBindingsForDCB().findIteratorBinding("SelectedSQIRSuppliersVO1Iterator");
    ArrayList list = new ArrayList();
    Row datRow = viewReportIter.getRowAtRangeIndex(0);
    programDesc = datRow.getAttribute(1).toString();
    list.add(programDesc);
    suppliers.setValue(list.toString());
    but is is not set the value.
    Is there any other method to set the value.
    Thanks,
    Neha

    Passing array in selectedindices
    To select default value as ALL the following code is used .
    int rowCount = (int)vo.getEstimatedRowCount();
    stateIndex =new int[rowCount];
    for(int i=0;i<rowCount;i++){
    stateIndex[i] = i;
    BindingContext bctx = BindingContext.getCurrent();
    BindingContainer bindings = bctx.getCurrentBindingsEntry();
    JUCtrlListBinding list=(JUCtrlListBinding) bindings.get("ViewObject");
    list.setSelectedIndices(stateIndex);
    To select default value other than all .
    BindingContext bctx = BindingContext.getCurrent();
    BindingContainer bindings = bctx.getCurrentBindingsEntry();
    JUCtrlListBinding list=(JUCtrlListBinding) bindings.get("ViewObject");
    list.setSelectedIndex(arg0);
    arg0 - The row which you want to set checked by default

  • How to programmatically set the value to current Page layout property?

    Hi,
    How do I set any text value to the current page layout [comment] property and save it.....here my current page is using a custom page layout called spPageLayout1
    To be very much generalized how I can set and save any value to current page property programmatically....on load event I need to set the value.
    It is a publishing page layout.

    Hi,
    According to your post, my understanding is that you want to set the value to current Page layout property.
    To get current page property, you can refer to:
    How to get current Pages details in SharePoint2010 publishing site
    Get Content Field Value in Article Page
    To get current page layout property, you can refer to:
    PublishingPage.Layout Property (Microsoft.SharePoint.Publishing)
    PageLayout.Title Property (Microsoft.SharePoint.Publishing)
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • Linking to a specific panel from another page and from higher up on same page Spry-UI-1.7

    Hi all,
    I am using Spry-UI-1.7 for a 4 tab tabbed panel on the bottom of my home page.  I'd like to link to the second tab from another page and also from the top of the home page.
    I previously used method: http://foundationphp.com/tutorials/spry_url_utils.php and it worked great.
    Now, with the Spry-UI-1.7 Tabbed Panel "widget", that method isn't working.
    I've reviewed the code from the samples page: http://labs.adobe.com/technologies/spry/samples/tabbedpanels/tabbed_panel_sample.htm
    but cannot figure out what I am doing wrong.  It shows the following code for linking from another page:
    <a href="#" onclick="TabbedPanels2.showPanel(1); return false;">Tab 2</a>
    I tried this 'as is' and it didn't work. 
    I tried it with index.html in place of the # and it didn't work.
    (e.g.   <a href="index.html" onclick="TabbedPanels2.showPanel(1); return false;">Tab 2</a>   )
    What am I missing here?
    (I have the tabbed panel on "index.html" and want to link from "maps.html" and from the top of "index.html"
    Thanks for any help for this spry newbie! (read: I need it spelled out like I was a 6 yr. old

    This works
    <!DOCTYPE HTML>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Untitled Document</title>
    <script type="text/javascript" src="SpryAssets/SpryURLUtils.js"></script>
    <script src="Spry-UI-1.7/includes/SpryDOMUtils.js" type="text/javascript"></script>
    <script src="Spry-UI-1.7/includes/SpryDOMEffects.js" type="text/javascript"></script>
    <script src="Spry-UI-1.7/includes/SpryWidget.js" type="text/javascript"></script>
    <script src="Spry-UI-1.7/includes/SpryPanelSet.js" type="text/javascript"></script>
    <script src="Spry-UI-1.7/includes/SpryPanelSelector.js" type="text/javascript"></script>
    <script src="Spry-UI-1.7/includes/SpryFadingPanels.js" type="text/javascript"></script>
    <script src="Spry-UI-1.7/includes/SpryTabbedPanels2.js" type="text/javascript"></script>
    <script src="Spry-UI-1.7/includes/plugins/TabbedPanels2/SpryFadingPanelsPlugin.js" type="text/javascript"></script>
    <script src="Spry-UI-1.7/includes/plugins/TabbedPanels2/SpryTabbedPanelsKeyNavigationPlugin.js" type="text/javascript"></script>
    <link href="Spry-UI-1.7/css/TabbedPanels2/SpryTabbedPanels2.css" rel="stylesheet" type="text/css">
    <script type="text/javascript"> var params = Spry.Utils.getLocationParamsAsObject(); </script>
    <script type="text/xml">
    <!--
    <oa:widgets>
      <oa:widget wid="2138522" binding="#TabbedPanels2" />
    </oa:widgets>
    -->
    </script>
    </head>
    <body>
    <div id="TabbedPanels2">
      <h2>Tab 1</h2>
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce sapien lacus, porttitor vitae pretium eget, sodales sed libero. Maecenas non urna lacus, ac sollicitudin justo. Ut erat mi, hendrerit ac accumsan ac, congue eu dui. Pellentesque consectetur condimentum elit, et eleifend urna porta id. Phasellus blandit ullamcorper dignissim. In rutrum, ante non congue fermentum, metus odio bibendum elit, ut congue sapien arcu ac justo. Vivamus sit amet erat nibh, quis dignissim libero. Pellentesque in sapien felis, et volutpat eros. Maecenas adipiscing, eros sit amet placerat cursus, arcu lacus consectetur lectus, non ultricies neque urna laoreet purus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. </p>
      <h2>Tab 2</h2>
      <p>Nulla facilisi. Vestibulum ipsum elit, tincidunt sed tristique sit amet, faucibus in orci. Nunc sit amet elit lorem. Sed eget arcu ipsum, pharetra ullamcorper lectus. Sed ac diam ac tortor mattis mollis. Etiam mattis felis vel augue tempus in rhoncus ligula elementum. Vestibulum ut iaculis risus. Aliquam erat sem, feugiat vel laoreet in, lobortis non mauris. Vestibulum neque nibh, vehicula eleifend tincidunt sed, bibendum id dolor. Pellentesque quis libero nec orci porttitor faucibus vitae in velit. Pellentesque dignissim sem ut justo interdum id egestas tellus fringilla. Vestibulum tempor, turpis eget dignissim luctus, est erat ultricies turpis, non tempus massa elit in nulla. Sed eu arcu vel enim laoreet hendrerit at vel enim. Integer semper malesuada sem quis porttitor.</p>
      <h2>Tab 3</h2>
      <p>Suspendisse potenti. Proin ut erat sit amet turpis egestas tempor. Integer arcu dolor, aliquam ut egestas nec, pharetra ut mauris. Duis urna mi, aliquam id vulputate et, consequat in dolor. Duis congue sem feugiat nulla malesuada scelerisque. Aenean vitae augue nec diam euismod imperdiet. In accumsan consectetur ante a vestibulum. Phasellus eu nulla et lectus tincidunt porttitor. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Proin mauris massa, venenatis ut fringilla interdum, imperdiet et neque. Sed ut risus metus.</p>
    </div>
    <script type="text/javascript">
    // BeginOAWidget_Instance_2138522: #TabbedPanels2
            var TabbedPanels2 = new Spry.Widget.TabbedPanels2("TabbedPanels2", {
                injectionType: "replace",
                widgetID: "TabbedPanels2",
                autoPlay: false,
                defaultTab: params.tab ? params.tab : 0,
                enableKeyboardNavigation: true,
                hideHeader: true,
                tabsPosition: "top",
                event:"click",
                stopOnUserAction: true,
                displayInterval: 5000,
                minDuration: 300,
                maxDuration: 500,
                stoppedMinDuration: 100,
                stoppedMaxDuration: 200,
                plugIns:[]
    // EndOAWidget_Instance_2138522
    </script>
    </body>
    </html>

  • Scope issue: Trying to set the value of a variable in a calling (upper) script from a called (lower) script

    Hi,
    I have a basic scope question . I have two .ksh scripts. One calls the other.
    I have a variable I define in script_one.ksh called var1.
    I set it equal to 1. so export var1=1
    I then call script_two,ksh from script_one.ksh.  In script_two.ksh I set the value of var1 to 2 . so var1=2.
    I return to script_one.ksh and echo out var1 and it still is equal to 1.
    How can I change the value of var1 in script_two.ksh to 2 and have that change reflected in script_one.ksh when I echo var1 out after returning from script_two.ksh.
    I've remember seeing this I just can't remember how to do it.
    Thanks in advance.

    Unfortunately Unix or Linux does not have a concept of dynamic system kernel or global variables.
    Environment variables can be exported from a parent to a child processes, similar to copying, but a child process cannot change the shell environment of its parent process.
    However, there are a few ways you could use: You can source execute the scripts, using the Bash source command or by typing . space filename. When source executing a script, the content of the script are run in the current shell, similar to typing the commands at the command prompt.
    Use shell functions instead of forking shell scripts.
    Store the output of a script into a variable. For instance:
    #test1.sh
    var=goodbye
    echo $var
    #test2.sh
    var=hello
    echo $var
    var=`./test1.sh`
    echo $var
    $ ./test2.sh
    hello
    goodbye

  • How to set the value of something in a component from the main application?

    Hi,
    Maybe I've been working on this too long, but I can't figure
    out how to set the value of the text property of a text input field
    in a component from my main application in an mx:Script block. I
    have a component called Login in the components folder, and I need
    to set the text value of empNum. In my mxml declaration at that the
    top, I've declared these components as xmlns:c="components.*" So
    logically, the property I'm trying to set is c.Login.empNum.text. I
    can't figure out the correct syntax to get this to work, and I've
    tried everything I can think of. Does anyone have any suggestions?
    I'm thinking this should be an easy one, and I'm just missing
    something.
    Thanks!
    Holli

    Did you try giving it an id ?
    <c:MyLogin id="loginScreen" /c>
    So later you can do loginScreen .empNum.text = "my text"
    Laurent,

  • How can I set the value to a session bean from backing bean

    Hi Experts,
    How can I set the value to a session bean from backing bean where I have created getter and setter
    methods for that variable.
    Basically I am using ADFUtils class where I am able to get the value from session bean
    using following expression
    String claimType =
    (String)ADFUtil.invokeEL("#{ClaimValueObj.getClaimType}");
    Thanks
    Gayaz

    Gayaz,
    Wrong Post !!
    Post in JDeveloper and ADF
    Thanks
    --Anil                                                                                                                                                                                                                               

  • Set the value of a CWNumEdit Control from within the code

    I am trying to update a CWNumEdit Control with data created during program execution.  I am using the set_Text function but it does not seem to be working.  I was wondering if there is something that I am missing to get this functionality to work.  Please help.
    I am developing a VS .NET 2003 WinForm GUI and am Using Measurement Studio 8.1.1.

    Hello mtd32610,
    I noticed this question was already posted on this forum.  We like to
    keep all questions related to a single issue confined to one forum, so
    please direct all future replies to one post or the other.
    As Jervin_J mentioned in the previous post, the standard method for
    updating a CWNumEdit control is to set the Value property of the
    CNiNumEdit object that is associated with this control.  You do not
    need to call the set_Text function, in fact I am not familiar with any
    set_Text function, so I think you may be calling this method on the
    wrong class altogether.
    You should have an object associated with your CWNumEdit control that
    you can set the Value property for.  As mentioned in the reply from
    Jervin_J, the normal way to populate the control is to use:
    <control>.Value = <numeric_value>;
    Regards,
    Marty H.
    National Instruments

Maybe you are looking for

  • User Exit for Travel

    Hi All,     I am using the user exit <b>EXIT_SAPMP56T_002</b> for travel management, to raise a message. The issue i am facing is, the message has to be displayed only if the user saves the transaction, if he clicks the approve button it should not r

  • HTTP 403 forbidden message on deployed web page

    Hi there, Since the day i have deployed my web application I am not able to login to the web page. I am  getting error HTTP 403 Forbidden, have permission to view the webpage. ideally it should have taken to login page and then asked for permission a

  • IDCS update won't apply in 10.5.6

    Has anyone had any problems updating CS to 3.0.1 in 10.5.6? After running the update, the application still says 3.0. Certain scripts will not run unless the app is updated. Some have asked if maybe the app doesn't show the update but makes the chang

  • Why do JPGs print as a mix of characters after Leopard upgrade?

    I can print MS Word document. I can print a Jpeg files through iPhoto. However,I can't print a JPEG with Photoshop CS3. It sends the file to my HP Color LaserJet 2550n, but it prints out several lines of mixed characters across dozens of pages. No im

  • While digitizing camcorder video, PE7 has begun splitting into lots of little video files.  Help!

    I have successfully imported/digitized ca. 80 analog Hi-8 camcorder home videos into PE7 from a Sony Digital Handycam camcorder via a FireWire cable/interface.  However, PE7 has now begun splitting the incoming video feed from the camcorder into lots