Form Returns Null Values or Empty Values For Variables After Clicking OK Button

I'm trying to create a new user based on a template user. Right now I just want to get the variables right, I just want to be able to select a template user, fill in the information that will be different, and click Create User. 
I'm not sure why this isn't working. I think the problem is in the code for the OK button or Enter keypress but I'm not sure what's wrong with the code I've entered. Any advice would be helpful. I'm sure it's something simple but I'm fairly new to powershell
and syntax has been rather tricky for me. Sorry if it's a rookie mistake and thanks for any advice.
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
Write-Host "Creating The Form For Selecting Templates"
$TemplateForm = New-Object System.Windows.Forms.Form
$TemplateForm.Text = "Select a Template"
$TemplateForm.Size = New-Object System.Drawing.Size(640,700)
$TemplateForm.StartPosition = "CenterScreen"
Write-Host "Enabling Keystroke Response on Form"
$TemplateForm.KeyPreview = $True
Write-Host "Defining Keystroke Response for Enter Key"
$TemplateForm.Add_KeyDown({if ($_.KeyCode -eq "Enter")
{$SelectedTemplate=$TemplateListBox.SelectedItem;$newuserfirstname=$FnameTextBox.Text;$newuserlastname=$LnameTextBox.Text;$newusertitle=$TitleTextBox.Text;$newuserhiringmanager=$MgrNameTextBox.Text;$newuserphonenumber=$PhoneNumberTextBox.Text;$newuserdepartment=$DeptTextBox.Text;$TemplateForm.Close()}})
Write-Host "Defining Keystroke Response for Esc Key"
$TemplateForm.Add_KeyDown({if ($_.KeyCode -eq "Escape")
{$TemplateForm.Close()}})
Write-Host "Placing OK Button On Form"
$OKButton = New-Object System.Windows.Forms.Button
$OKButton.Location = New-Object System.Drawing.Size(75,550)
$OKButton.Size = New-Object System.Drawing.Size(75,23)
$OKButton.Text = "Create User"
$OKButton.Add_Click({$SelectedTemplate=$TemplateListBox.SelectedItem;$newuserfirstname=$FnameTextBox.Text;$newuserlastname=$LnameTextBox.Text;$newusertitle=$TitleTextBox.Text;$newuserhiringmanager=$MgrNameTextBox.Text;$newuserphonenumber=$PhoneNumberTextBox.Text;$newuserdepartment=$DeptTextBox.Text;$TemplateForm.Close()})
$TemplateForm.Controls.Add($OKButton)
Write-Host "Placing Cancel Button On Form"
$CancelButton = New-Object System.Windows.Forms.Button
$CancelButton.Location = New-Object System.Drawing.Size(150,550)
$CancelButton.Size = New-Object System.Drawing.Size(75,23)
$CancelButton.Text = "Cancel"
$CancelButton.Add_Click({$TemplateForm.Close()})
$TemplateForm.Controls.Add($CancelButton)
Write-Host "Placing Label On Template List Box"
$TemplateListLabel = New-Object System.Windows.Forms.Label
$TemplateListLabel.Location = New-Object System.Drawing.Size(10,20)
$TemplateListLabel.Size = New-Object System.Drawing.Size(280,20)
$TemplateListLabel.Text = "Please fill out the following new user information:"
$TemplateForm.Controls.Add($TemplateListLabel)
Write-Host "Creating Template List Box for Form"
$TemplateListBox = New-Object System.Windows.Forms.ListBox
$TemplateListBox.Location = New-Object System.Drawing.Size(10,40)
$TemplateListBox.Size = New-Object System.Drawing.Size(260,20)
$TemplateListBox.Height = 520
Write-Host "Placing Label On First Name Box for Form"
$FnameTextLabel = New-Object System.Windows.Forms.Label
$FnameTextLabel.Location = New-Object System.Drawing.Size(300,20)
$FnameTextLabel.Size = New-Object System.Drawing.Size(95,20)
$FnameTextLabel.Text = "First Name:"
$TemplateForm.Controls.Add($FnameTextLabel)
Write-Host "Creating First Name Box for Form"
$FnameTextBox = New-Object System.Windows.Forms.TextBox
$FnameTextBox.Location = New-Object System.Drawing.Size(300,40)
$FnameTextBox.Size = New-Object System.Drawing.Size(95,20)
$TemplateForm.Controls.Add($FnameTextBox)
Write-Host "Placing Label On Last Name Box for Form"
$LnameTextLabel = New-Object System.Windows.Forms.Label
$LnameTextLabel.Location = New-Object System.Drawing.Size(400,20)
$LnameTextLabel.Size = New-Object System.Drawing.Size(95,20)
$LnameTextLabel.Text = "Last Name:"
$TemplateForm.Controls.Add($LnameTextLabel)
Write-Host "Creating Last Name Box for Form"
$LnameTextBox = New-Object System.Windows.Forms.TextBox
$LnameTextBox.Location = New-Object System.Drawing.Size(400,40)
$LnameTextBox.Size = New-Object System.Drawing.Size(95,20)
$TemplateForm.Controls.Add($LnameTextBox)
Write-Host "Placing Label On Department Box for Form"
$DeptTextLabel = New-Object System.Windows.Forms.Label
$DeptTextLabel.Location = New-Object System.Drawing.Size(500,20)
$DeptTextLabel.Size = New-Object System.Drawing.Size(95,20)
$DeptTextLabel.Text = "Department:"
$TemplateForm.Controls.Add($DeptTextLabel)
Write-Host "Creating Department Box for Form"
$DeptTextBox = New-Object System.Windows.Forms.TextBox
$DeptTextBox.Location = New-Object System.Drawing.Size(500,40)
$DeptTextBox.Size = New-Object System.Drawing.Size(95,20)
$TemplateForm.Controls.Add($DeptTextBox)
Write-Host "Placing Label On Title Box for Form"
$TitleTextLabel = New-Object System.Windows.Forms.Label
$TitleTextLabel.Location = New-Object System.Drawing.Size(300,70)
$TitleTextLabel.Size = New-Object System.Drawing.Size(95,20)
$TitleTextLabel.Text = "Title:"
$TemplateForm.Controls.Add($TitleTextLabel)
Write-Host "Creating Title Box for Form"
$TitleTextBox = New-Object System.Windows.Forms.TextBox
$TitleTextBox.Location = New-Object System.Drawing.Size(300,90)
$TitleTextBox.Size = New-Object System.Drawing.Size(95,20)
$TemplateForm.Controls.Add($TitleTextBox)
Write-Host "Placing Label On Manager Name Box for Form"
$MgrNameTextLabel = New-Object System.Windows.Forms.Label
$MgrNameTextLabel.Location = New-Object System.Drawing.Size(400,70)
$MgrNameTextLabel.Size = New-Object System.Drawing.Size(95,20)
$MgrNameTextLabel.Text = "Manager's Name:"
$TemplateForm.Controls.Add($MgrNameTextLabel)
Write-Host "Creating Manager's Name Box for Form"
$MgrNameTextBox = New-Object System.Windows.Forms.TextBox
$MgrNameTextBox.Location = New-Object System.Drawing.Size(400,90)
$MgrNameTextBox.Size = New-Object System.Drawing.Size(95,20)
$TemplateForm.Controls.Add($MgrNameTextBox)
Write-Host "Placing Label On Manager Name Box for Form"
$PhoneNumberTextLabel = New-Object System.Windows.Forms.Label
$PhoneNumberTextLabel.Location = New-Object System.Drawing.Size(500,70)
$PhoneNumberTextLabel.Size = New-Object System.Drawing.Size(95,20)
$PhoneNumberTextLabel.Text = "Phone Number:"
$TemplateForm.Controls.Add($PhoneNumberTextLabel)
Write-Host "Creating Phone Number Box for Form"
$PhoneNumberTextBox = New-Object System.Windows.Forms.TextBox
$PhoneNumberTextBox.Location = New-Object System.Drawing.Size(500,90)
$PhoneNumberTextBox.Size = New-Object System.Drawing.Size(95,20)
$TemplateForm.Controls.Add($PhoneNumberTextBox)
Write-Host "Creating Fake List of Templates"
$TemplateGroupList = "Test"
$TemplateForm.Controls.Add($TemplateListBox)
Write-Host "Ensuring List Box appears in front of other windows"
$TemplateForm.Topmost = $True
$TemplateForm.Add_Shown({$TemplateForm.Activate()})
[void] $TemplateForm.ShowDialog()
$SelectedTemplate
$newuserfirstname
$newuserlastname
$newusertitle
$newuserhiringmanager
$newuserphonenumber
$newuserdepartment
Pause

If you plan on performing all of the work under the Click event, then you won't need to worry about assigning a Script scope to the variables, but if you are planning on using those variables outside of the Event, then David's answer is the way to go.
Another option is to use a hash table as it also works around the issue with variable scope in a UI Event.
#Define at beginning of script
$hashtable = @{}
$OKButton.Add_Click({$hashtable.SelectedTemplate=$Something})
Boe Prox
Blog |
Twitter
PoshWSUS |
PoshPAIG | PoshChat |
PoshEventUI
PowerShell Deep Dives Book

Similar Messages

  • No Value could be determined for variable ZCE0018

    Hi experts,
    I am getting an error while running reports for few selections on Sales Org.(without giving site/store) as below
    It is working fine with some other sales org.
    *Selection covers data from multiple comp.codes which carry more than one Fisc.Yr Variant not possible to report in multiple Fy variants.Plz refine selections.
    *No Value could be determined for variable ZCE0018.
    Please reply me how to rectify this error.
    Thanks in advance.
    regards,
    <BMP>

    Hello,
    the description for the error is:
    Diagnosis
    This error diagnosis is specific only to the variables 0P_FVAEX or 0P_CTPCA !
    Termination message BRAIN 632 appears:
    Could not determine value for variable 0P_FVAEX (or 0P_CTPCA).
    System Response
    1. Operation method of SAP-Exit-Variables 0P_FVAEX or 0P_CTPCA
    With queries from the CO application, both SAP-Exit-Variables look for an entry for 'controlling area'. With this controlling area from the selection screen, the SAP-Exit-Variables program reads the attributes for InfoObject 0CO_AREA (controlling area).
    With queries from the FI application, the SAP Exit Variable 0P_FVAEX looks for an entry for 'company code'. With this company code from the selection screen, the SAP Exit Variables program reads the attributes for InfoObject 0COMP_CODE (Company Code).
    0P_FVAEX determines the fiscal year variant (attribute 0FISCVARNT) from the attributes for 0CO_AREA (CO queries) or 0COMP_CODE (FI queries). 0P_CTPCA determines the currency type of the profit center local currency (attribute 0CURTP_PCA) from the attributes for 0CO_AREA.
    2. Cause of Error
    The attributes for the controlling area (InfoObject 0CO_AREA) or company code (InfoObject 0COMP_CODE) were not loaded into the BW system, or the attributes for the controlling area are not active in the BW system.
    Check whether this is the cause of the error in your BW system. Display the contents of table /bi0/mco_area or /bi0/mcomp_code using transaction se16.
    Application CO:
    Check whether the attributes 'fiscal year variant' (field FISCVARNT) and 'profit center local currency currency type' (field CURTP_PCA) are filled in the 'A' version (field OBJVERS) for the selected controlling area. If the fiscal year variant in the OBJVERS = 'A' is empty, then the error is with variable 0P_FVAEX. If the currency type of the profit center's local currency in OBJVERS = 'A' is empty, then the error is with variable 0P_CTPCA.
    Application FI:
    Check whether or not the attribute 'fiscal year variant' (field FISCVARNT) is filled in the 'A' version (field OBJVERS) for the selected controlling area. If the fiscal year variant is empty in OBJVERS= 'A', then the error is with variable 0P_FVAEX.
    Procedure
    Using InfoSource 0CO_AREA, load the attributes for the controlling area or company code into your BW system.
    Afterwards, activate the attribute changes in your BW system. To do this, use transaction rsa1, path 'Tools > Hierarchy/Attribute changes', functions button 'InfoObject list'. Choose InfoObject 0CO_AREA or 0COMP_CODE from this list, and activate the attribute changes.
    Check through the context in the report what variables are affecting. Anyways it is a BW issue not SCM Logistics, please contact someone from BW-BEX or create a SDN thread in BW forum.
    Best Regards,
    Christian Rosa

  • No value could be determined for variable (Material)

    Hi,
    I have Planning filter where im restricting the Material with a Zvariable. This is a Customer Exit variable. This works fine in development but throws me error No value could be determined for variable (Material) in QA system.
    Could some one help me in resolving this in
    Thanks

    either your code is wrong or you just have no data.
    debug the code, check if you do have the desired data according to your code.
    regards
    Cornelia

  • No value could be determined for variable 0P_KEYD2

    Hello Gurus,
    I am creating a report for Vendor Ageing. I have included the characteristic 0PSTNG_DATE (with restriction variable - 0P_KEYD2) . when I execute the query it gives the following error :-
    No value could be determined for variable 0P_KEYD2.
    Do I need to edit the SAP Exit for modifications. The query does'nt prompt me for a Key Date.
    Thanks in advance..

    Hi,
    Did you not find any code for the variable in the include program. Try activating the variable in the business content using before and after data flow.
    Also check this link:
    http://help.sap.com/saphelp_nw04/helpdata/en/ea/fd740780b135428ed0016168974284/content.htm
    Bye
    Dinesh
    (Do not forget to assign points!!)

  • Hi, I have quick question about use of USEBEAN tag in SP2. When I specify a scope of SESSION for the java bean, it does not keep the values that I set for variable in the bean persistent.Thanks,Sonny

     

    Make sure that your bean is implementing the serializable interface and that
    you are accessing the bean from the session with the same name.
    Bryan
    "Sandeep Suri" <[email protected]> wrote in message
    news:[email protected]..
    Hi, I have quick question about use of USEBEAN tag in SP2. When I
    specify a scope of SESSION for the java bean, it does not keep the
    values that I set for variable in the bean persistent.Thanks,Sonny
    Try our New Web Based Forum at http://softwareforum.sun.com
    Includes Access to our Product Knowledge Base!

  • No value could be determined for variable 0P_FVAEX

    We are on BW 7.0 and BEx7.0
    I have activated BI Content of InfoCube  0WBS_C11 and all it's SAP delivered Query elements. The InfoCube is loaded with data already.
    When I run any of the query in BEx, I got the same error as below:
    Initial RANGE-LOW for customer exit variable 0P_FVAEX corrected to #
    No value could be determined for variable 0P_FVAEX
    Please help.
    Thanks

    Hi,
    There is no value for the variable 0P_FVAEX for fiscalyear variant. default it is populating #.
    In company code masterdata(attr & text) there should be fiscalyear variant for FI loading and Controlling area masterdata for other modules loading. 0FISCVART should be filled in masterdata (company code/ controlling area) then you can get report .
    If it is not there in the masterdata ask the functional consultant fill the company code data with fiscalyear variant.
    This should  solve the error.
    Thanks,
    Satya

  • Text Variable error "No value could be determined for variable " Brain 632

    Hi,
    I want to display current fiscal period as description in the colomn of a query.
    Ex. If current fiscal period is 005.2009 in the colomn it should display 2009005
    For that I have created a text variable.(Is it correct to create a text variable for this?)
    But it gives me following error.
    "No value could be determined for variable " Brain 632 Error.
    Please help.

    I assume that your requirement is suppose a user enter a date as 01/12/2010 - 31/12/2010 in the selection screen then he should get the data for this  range in one keyfigure and 01/11/2010 - 31/11/2010
    For this requirement you have to create one customer exit variable on calendar day :
    I have taken into account only the two values .
    Important is to take into account what if a month has 31 days and previous month has 30 days.
    The user exit will trow an error in this case .
    You need to handle this in the code .
    Data :
    day type string,
    year type string ,
    Month type string ,
    LS_Calday type Date.
    IF i_step = 2.
      CLEAR loc_var_range.
      READ TABLE i_t_var_range INTO loc_var_range
        WITH KEY vnam = 'Z_PCG1'.
    day = loc_var_range-low+6(2) .
    Year=loc_var_range-low+0(4).
    Month =loc_var_range-low+4(2) .
    if month = 01 ,
    year= year -1 .
    month = '12'
    concatenate year month day into LS_Calday .
    else if month = 03
    and day =31 or day = 30 or day = 29 .
    day = 28 .
    month = month -1 .
    month_high = month 
    concatenate year month day into LS_Calday .
    else if month = 05 or month = 07 or month = 10 .
    month = month -1 .
    concatenate year month day into LS_Calday .
        CLEAR l_s_range.
        l_s_range-low  = LS_Calday .
         l_s_range-sign = 'I'.
        l_s_range-opt  = 'EQ'.
        APPEND l_s_range TO e_t_range.
      ENDIF.
    ENDIF.
    restrict the first keyfigure with the user input variable and second with this customer exit variable .

  • Error while executing customer Exit Variable (No value could be determined for variable.  BRAIN 632)

    Hello,
    I created a customer exit variable which has to show the range between the first and last day of the previous month. The query will be executed every first of the month.
    Variable is declared as: Customer exit, based on 0CALDAY, Interval, Mandatory and NOT input.
    When i debug the query, it is making the calculation but its not populating my variable; when I execute the query from RSRT, the output test shows a message:
    ENo value could be determined for variable ZRANGE_PREVMONTH.                            BRAIN               632ZRANGE_PREVMONTH
    Below the code i'm using (SAP 7.4)
    ***Customer Exit to calculate previous month.
    IF i_step = 2.
         CASE i_vnam.
              WHEN 'ZRANGE_PREVMONTH'.
    DATA:  LS_RA_SID  TYPE   RSR_S_RANGESID.
    DATA:  yyyy(4) TYPE n.
    DATA:  mm(2) TYPE n.
    DATA:  dd(2) TYPE n.
    DATA:  fst_date LIKE sy-datum.
    DATA:  fst_date2 LIKE sy-datum.
    LOOP AT i_t_var_range_c INTO loc_var_range
        WHERE vnam = '0DAT'.
          dd = sy-datum+6(2).
          mm = sy-datum+4(2).
          yyyy = sy-datum+0(4).
          fst_date2 = sy-datum.
          IF dd = '01' AND mm = '01'.
            mm = '12'.
            yyyy = yyyy - 1.
          ELSEIF dd = '01' AND mm <> '01'.
            mm = mm - 1.
          ELSEIF dd <> '01'.
            mm = mm - 1.
          ENDIF.
          CLEAR: fst_date.
          CONCATENATE yyyy mm '01' INTO fst_date.
          fst_date2 = fst_date2 - 1.
          CLEAR: ls_ra_sid.
          ls_ra_sid-sign = 'I'.
          ls_ra_sid-opt = 'BT'.
          ls_ra_sid-high = fst_date2.
          ls_ra_sid-low = fst_date.
          APPEND ls_ra_sid TO e_t_range.
    ENDLOOP.
    ENDCASE.
       ENDIF.

    Hi Fernanda,
    Try this:
    DATA:  LS_RA_SID  TYPE   RSR_S_RANGESID.
    DATA:  fst_date LIKE sy-datum.
       CASE i_vnam.
              WHEN 'ZRANGE_PREVMONTH'.
    fst_date = sy-datum - 1.
    concatenate fst_date(6) '01' into ls_ra_sid-low.
          ls_ra_sid-sign = 'I'.
          ls_ra_sid-opt = 'BT'.
          ls_ra_sid-high = fst_date.
          APPEND ls_ra_sid TO e_t_range.
    ENDLOOP.
    ENDCASE.
       ENDIF.
    Just post here for any queries..
    Regards,
    Loed

  • Issue with empty value of LOV of first row after clicking on add row button

    JDeveloper 11.1.14
    I have a page with table-form layout.
    In the form I have two detail tables on the same page (tabbed).
    I have an issue with using model-choicelist LOV's in the detail tables.
    I am able to add a new row in the detail table, select a value from the model-choiceList LOV (which is required) and save the new row.
    After adding another row in this table the value of the model-choiceList LOV in the previous row is suddenly empty on the screen. It is not empty in the database,
    I have checked it in the datbase. Only the value of the LOV of the first row on the page is being cleared after clicking on the add row button.
    After saving the new row I get the following error on the screen:
    Error: a selection is required. --> first row
    Does anyone have a suggestion how to solve this issue?

    After adding another row in this table the value of the model-choiceList LOV in the previous row is suddenly empty on the screen. It is not empty in the database, Is the complete LOV blank or only the selected value .. can you try putting autoSubmit=true in the LOV and try ? Also check if you have any partialTriggers on the LOV from the add button ?

  • Sort values in input help for variables

    Hi there,
    Users often get annoyed by the input help in our web-reports. As the data in the InfoProvider grows, the variable values in the input help screens gets over-populated.
    Often old values (eg. 0CALMONTH) are displayed first and users have to scroll trough 8 blocks of values before they get the value they are looking for.
    It is kind of a practical issue, but does any of you know how to <b>sort</b> the values in the input help screen?
    Kind regards,
    Hans de Klein

    Hi Hans,
    I can suggest you one way but i am not sure it will work in your scenario.
    Where ever you have used variables. Lets say 0CALMONTH.
    You must have restricted this with some variable.
    Goto The Property of 0CALMONTH(By right clicking) and check the sort property.Also select you want to sort on Key/Text.
    Hope it helps.
    Regards,
    Parth.

  • VBELN Value to be populated in browser after clicking the number in ALV

    Hello All,
    This is my requirement.I have written a report. It displays the values in ALV format. When i click any item on the alv grid.It should take me to any of the browser and the item number should be filled there.I am working for the transaction VA03.
    I have used FM CALL_BROWSER to call the URL.
    Can anybody help me out.
    Thanks,
    Indrakaran

    Hello Vijay,
    I am using report program to call the browser and display the VBELN value in the browser window not BSP.
    Thanks,
    IndraKaran

  • I requested a repair, but there was an error after clicking the button with my credit card info. I was still charged, but the form email I received the next day had incorrect info about my iPod Touch problem. How can I contact CS w/o paying $19?!

    My iPod Touch battery is not working. I requested a repair through the Apple Support. On the final page, when I clicked the button that puts the info through with your credit card number, the resulting page gave an error (I wish I'd have saved it!). Anyhow, I checked my credit card and it was charged, so I assumed the repair request went through. The next day I received a form email saying my problem was with "Sync with iTunes (Not iCloud) - Data Backup/Migration (not iCloud)" instead of the battery repair. It also says for iPod customers, to send your iPod to Apple - but I had requested the "iPod Coffin" to be mailed to me so I could send it back. Obviously there was an error between the request and what was received, so I'd like to ask Customer Service about it. However, I can't find a way to contact them. When I replied to that form email, I recieved an automated reply saying emails there were not read. Anything online asks me to pay $19 and I don't have the correct issues to request an exception. The closest store is over an hour away or I'd simply go there to ask. What can I do?! Any suggestions you have are much appreciated. Thank you!
    PS - The form email also says if I wait 10 days the repair request will be canceled. Does this mean my credit card will be refunded for the $85 battery replacement charge if it is canceled automatically?

    Thanks, but I've been on the phone with AppleCare US (where I am and live) and AppleCare UK. They continue bouncing me back and forth without helping resolve the problem.
    Perhaps someones knows how to further escalate the issue at Apple?

  • How can we create a popup window for confirmation while clicking of button

    HI Friends,
    I am creating a application, In which I want to create a popup window for confirmation on clicking of a button.
    I also need two buttons on popup window i.e. 'Yes' & 'No'.
    On yes i want to perform some operation and on No i want to cancel that operation.

    Hi Narendra,
    try using the following code in ONACTION of ur button for popup :
    * Popup
       *  Generate Popup
        DATA lo_window_manager TYPE REF TO if_wd_window_manager.
        DATA lo_api_component  TYPE REF TO if_wd_component.
        DATA lo_window         TYPE REF TO if_wd_window.
        lo_api_component  = wd_comp_controller->wd_get_api( ).
        lo_window_manager = lo_api_component->get_window_manager( ).
        lo_window         = lo_window_manager->create_window(
          window_name          = 'W_POPUP'
         window_position = if_wd_window=>co_center
          message_display_mode = if_wd_window=>co_msg_display_mode_selected
          button_kind          = if_wd_window=>co_buttons_yesno
          message_type         = if_wd_window=>co_msg_type_none
          default_button       = if_wd_window=>co_button_yes
        DATA:  l_api TYPE REF TO if_wd_view_controller.
        l_api = wd_this->wd_get_api( ).
        " subscribe action for Ok button
        lo_window->subscribe_to_button_event(
                     button            = if_wd_window=>co_button_yes
                     action_name       = 'OK_POPUP'
                     action_view       = l_api
                     is_default_button = abap_true ).
        lo_window->open( ).
    regds,
    amit

  • Hidden field in form returns null value

    Hi all - I searched for this but found nothing that fit my problem although various other problems came up.
    I have a Login jsp, with a simple form for username and password:
    <form name="login" method="post" action="servlet/ControlServlet"
    onSubmit="return validateForm()"><table width="180" border="0"
    cellspacing="0" cellpadding="0">
                <tr>
                  <td width="96" class="logintext">Username</td>
                  <td width="84"> </td>
                </tr>
                <tr>
                  <td><input name="username" type="text" size="15"
    maxlength="15"></td>
                  <td><input type="submit" name="Submit" value="Login"></td>
                </tr>
                <tr>
                  <td class="logintext">Password</td>
                  <td> </td>
                </tr>
                <tr>
                  <td class="logintext"><input name="password" type="password"
    size="15" maxlength="15"></td>
                  <td><input name="actionCode" type="hidden" value="0"></td>
                </tr>
                <tr>
                  <td> </td>
                  <td><div align="center"><a href
    ="Register.jsp"><i>Register</i></a></div></td>
                </tr>
              </table>
              </form>Nothing complex in that form. my hidden field is actionCode and it should pass a 0 to my ControlServlet servlet.
    Here is a snippet from my servlet:
    import java.io.* ;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class ControlServlet extends HttpServlet {
      public void doPost(HttpServletRequest request,
                        HttpServletResponse response)
          throws ServletException, IOException {
        response.setContentType("text/html");
                //get the printwriter to output for debugging
                PrintWriter out = response.getWriter();
                //read in form variables
            //String formUsername = request.getParameter("username");
            //String formPassword = request.getParameter("password");
            String action = request.getParameter("actionCode");
            //convert String to int for action
            //int actionInt = Integer.parseInt(action);
            //add action variable to request
            request.setAttribute("aktion", action);
                //debug point 1
                //use requestDispatcher to forward session info to JSP
               RequestDispatcher dispatcher =
               request.getRequestDispatcher("/mvcoutput.jsp");
               dispatcher.forward(request, response);I have commented out a bit for debugging purposes, but basically, the form variables are read in, the username and password don't give me any problems, but the actionCode does. Upon forwarding to a basic jsp for testing my output displays value "null" when using the command:
    request.getAttribute("aktion")Any reason why the hidden field is playing silly buggers ??
    cheers

    Anyone ???
    If I have a field in an html form which is hidden, do I retrieve it in the SAME WAY that I retrieve the non hidden form fields i.e. using the request.getParameter() method ??
    Cheers.

  • Function in where clause is executed and returns null instead a valid value

    Hi all
    i have a strange problem.
    There is a access-application where i have a pass-through-sql.
    This sql is fetching a foreign exchange rate from a history table which holds this rates for every day and i'm going to fetch the rate for the last day of the last month.
    Example of the fraction which does not work and which i executed directly on the DB, Oracle 11.2.0.3.0:
    select val
    ,last_day(add_months((trunc(sysdate)+3),-1)) tag
    from k.obj_ts_hist th
    where obj_id = 2660
    and eff_date = last_day(add_months((trunc(sysdate)+3),-1))
    --and      eff_date = '01-mar-2013'
    eff_date on table k.obj_ts_hist is defined as date.
    The function last_day in the where clause leads to null for both values in the select (val and tag).
    If i use eff_date = '01-mar-2013' it's all ok, i get the rigth values.
    I tested some combinations of the clause, e.g.
    eff_date = to_date(to_char(last_day(add_months((trunc(sysdate)+3),-1)),'YYYYMMDD'),'YYYYMMDD')
    or
    to_char(eff_date,'YYYYMMDD') = to_char(last_day(add_months((trunc(sysdate)+3),-1)),'YYYYMMDD') , etc., but all of them do not work.
    Also i tested the clause with select ... from dual, e.g.
    select eff_date from
    select last_day(add_months((trunc(sysdate)+3),-1)) eff_date from dual
    where eff_date = last_day(add_months((trunc(sysdate)+3),-1))
    This work's !
    A cross check on Oracle 9.2.0.8.0: it works as expected !
    Thanks in advance for your effort.
    Regards, Konrad

    a little simulation of your formula
    select the_date,last_day(add_months((trunc(the_date) + 3),-1)) eff_date
      from (select to_date('20130224','yyyymmdd') + level - 1 the_date
              from dual
            connect by level <= 7
           )reveals you might have been querrying future rates
    THE_DATE   EFF_DATE 
    24.02.2013 31.01.2013
    25.02.2013 31.01.2013
    26.02.2013 28.02.2013  /* future date */
    27.02.2013 28.02.2013  /* future date */
    28.02.2013 28.02.2013  /* current date */
    01.03.2013 28.02.2013
    02.03.2013 28.02.2013Regards
    Etbin

Maybe you are looking for