Skip to Content
author's profile photo Former Member
Former Member

Value from java script to ABAP

Hi

Please tell me how to get value from java script to ABAP variable.Here I have a Date variable Which is the input.After the client validations I have to move this value to LV_DATE which is ABAP variable.Please see my code and help me.

<script type="text/javascript">

function checkInput()

{

var dateval = document.form1.date.value

alert(dateval);

var today = new Date();

var get_date = today.getDate();

if (get_date < 9)

{

get_date = "0"+get_date;

}

var get_month = today.getMonth()+1;

if (get_month < 9)

{

get_month = "0"+get_month;

}

var today_date = get_date"."get_month"."(today.getFullYear());

alert(today_date);

if (dateval == "" || dateval > today_date)

{

alert("please enter date less than or equal to today");

}

else

{

htmlbSL(this,2,'mybutton:Submit');

}

}

</script>

<htmlb:tray id = "t1"

title = "Sample Window"

design = "BORDERLESS"

isCollapsed = "false"

width = "75%" >

<htmlb:trayBody>

<htmlb:textView text = "Hello World!"

textColor = "RED"

design = "HEADER1"

align = "CENTER" />

<htmlb:inputField id = "date"

type = "DATE"

showHelp = "TRUE"

alignment = "CENTER"

/>

<htmlb:button id = "mybutton"

text = "Press Me"

onClientClick = "javascript:checkInput();" />

</htmlb:trayBody>

</htmlb:tray>

I am new to BSP Please tell me indetail.I also went through the previous posts but I didn't get it perfectly.

Thank You.

Regards

Giri.

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on Jun 28, 2007 at 01:27 PM

    Do the below changes:

    <htmlb:inputField id = "date"
    type = "DATE"
    showHelp = "TRUE"
    value = "<%= LV_DATE %>"
    alignment = "CENTER"
    />

    TO Get the value from FORM...<b>In OnInputprocessing:</b>

    LV_DATE = request->get_form_field( 'date' ).

    <i>*Reward each useful answer</i>

    Raja T

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 28, 2007 at 01:26 PM

    Hi!

    First you need a form tag around your coding. It could look like this:

    <htmlb:form id = "form1">
    </htmlb:form>

    And you need to declare your variable "date" at page attributes of your BSP. Don't forget to set the "auto flag".

    Hope this helps

    Regards

    Mark-André

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.