Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 558
  • Last Modified:

HTML code - set variable value

How do I set my [08]Subject equal to the value selected in [08]Logtypeid when the submit button is push in this page?
<!DOCTYPE html>
<html>
<!-- start right frame -->
<head>
<title>~[text:psx.html.admin_students.newlogentry.new_log_entry]</title>
~[wc:commonscripts]
<link href="/images/css/screen.css" rel="stylesheet" media="screen">
<link href="/images/css/print.css" rel="stylesheet" media="print">~[x:logtypejs]
</head>

<body>

<form action="/admin/changesrecorded.white.html" method="POST">
~[wc:admin_header_frame_css]<!-- breadcrumb start --><a href="/admin/home.html" target="_top">~[text:psx.html.admin_students.newlogentry.start_page]</a> &gt; <a href="home.html?selectstudent=nosearch" target="_top">~[text:psx.html.admin_students.newlogentry.student_selection]</a> &gt; <a href="/admin/students/log.html?frn=~(studentfrn)">~[text:psx.html.admin_students.newlogentry.log_entries]</a> &gt;~[text:psx.html.admin_students.newlogentry.new_log_entry1]<!-- breadcrumb end -->~[wc:admin_navigation_frame_css]

~[wc:title_student_begin_css]~[text:psx.html.admin_students.newlogentry.new_log_entry2]~[wc:title_student_end_css]

<!-- start of content and bounding box -->
<div class="box-round">

<table border="0" cellspacing="0" cellpadding="4">
<tr bgcolor="#f6f6f6">
<td colspan="2" class="bold">~[text:psx.html.admin_students.newlogentry.general_log_information]</td>
</tr>
<tr bgcolor="#edf3fe">
<td class="bold">~[text:psx.html.admin_students.newlogentry.student]</td>
<td>~(studentname)</td>
</tr>
<tr>
<td class="bold">~[text:psx.html.admin_students.newlogentry.date_amp_time]</td>
<td><input type="text" name="[08]entry_date" value="~[short.date]" size="12" onChange="checkDates('~(JSFieldParam;[08]entry_date)');"><input type="text" name="[08]entry_time" value="~[time]" size="8"></td>
</tr>
<tr bgcolor="#edf3fe">
<td class="bold">~[text:psx.html.admin_students.newlogentry.author]</td>
<td><input type="text" name="[08]entry_author" value="~[x:username]" size="26"></td>
</tr>
<tr>
<td class="bold">~[text:psx.html.admin_students.newlogentry.log_type]</td>
<td><select name="[08]logtypeid" special="lists.logtype" onchange="setMenu(this)"><option></select></td>
</tr>
<tr bgcolor="#edf3fe">
<td class="bold">~[text:psx.html.admin_students.newlogentry.subtype_optional_for_discipline]</td>
<td>~[x:subtype]</td>
</tr>
<tr>
<td class="bold">~[text:psx.html.admin_students.newlogentry.consequence_optional_for_discipline]</td>
<td><select name="[08]consequence" special="lists.consequence"><option></select></td>
</tr>
<tr>
<td class="bold">~[text:psx.html.admin_students.newlogentry.subject]</td>
<td><input type="text" name="[08]Subject"></td>
</tr>
</td>
</tr>
<tr>
<td class="bold">~[text:psx.html.admin_students.newlogentry.log_entry_text]</td>
<td><textarea name="[08]entry" rows="6" cols="40"></textarea></td>
</tr>

<br>

<div class="button-row"><input type="hidden" name="ac" value="prim"><input type="hidden" name="[08]subtype" value=" "><input type="hidden" name="[08]studentid" value="~(curstudid)">~[submitbutton]</div>
</div>
<br>
<!-- end of content of bounding box -->

~[wc:admin_footer_frame_css]
</form>

</body>
</html><!-- end right frame -->

Open in new window

0
TAS-IT
Asked:
TAS-IT
  • 7
  • 5
  • 2
1 Solution
 
Dave BaldwinFixer of ProblemsCommented:
Since your 'action' page is an HTML page, you can't.  HTML is strictly a page description language, you can't use it for programming, not even variable substitution.  You need some kind of server side language like ASP or PHP to process your POST data and write a new page.
0
 
Michel PlungjanIT ExpertCommented:
<form action="/admin/changesrecorded.white.html" method="POST"
onsubmit="this.elements['[08]Subject'].value=this.elements['[08]Logtypeid'].value">
0
 
TAS-ITAuthor Commented:
Hi DaveBalwin,
What about using JavaScript?

Hi mplungian.
I tried the code, but no luck
0
Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

 
Michel PlungjanIT ExpertCommented:
What does "no luck" mean. Errors or missing value?
If we understood what you need to do we could help better. If you are doing what I THINK you are, then my code should work.
0
 
Dave BaldwinFixer of ProblemsCommented:
You could use javascript to change a value.  What will you do with it then?
0
 
Michel PlungjanIT ExpertCommented:
Ps: Dave is correct by the way you cannot POST to HTML. Change to get and look at the querystring. I missed the POST
0
 
TAS-ITAuthor Commented:
Hi mplungian,
attached is the new code with the code you suggested.  That is the only part that changed from the original posting.  After I inserted the code, when I created a test entry, the value did not copy to [08]subject
0
 
TAS-ITAuthor Commented:
the value for [08]subject was blank
0
 
Michel PlungjanIT ExpertCommented:
1: change to get

<form action="/admin/changesrecorded.white.html" method="GET"
onsubmit="this.elements['[08]Subject'].value=this.elements['[08]Logtypeid'].value">

2: in /admin/changesrecorded.white.html add
<script>
alert(location.search)
</script>

and see you should have the value of [08]subject equal to 08]Logtypeid
0
 
TAS-ITAuthor Commented:

This is the text box that shows up after I click the submit button.
----
?ac=prim&UF-008013-1=C&UF-008002-1=2623&btnSubmit=&UF-008005-1=09%2F27%2F2011&UF-008006-1=07%3A06+AM&UF-008004-1=Liu%2C+Cong&UF-008012-1=1951&subtype=C&UF-008014-1=Lunch+Detention&UF-008009-1=testing+code+again
----

The [08]Subject is still blank
0
 
Michel PlungjanIT ExpertCommented:
I do not even see [08]studentid

Are we talking about the same form here???

can you give a URL?
0
 
TAS-ITAuthor Commented:
The student ID is passing correctly, its passed as a hidden field i believe.  If you look at the code.  On line 62, it reference the studentID.

I am not able to give you the URL as it requires an login credentials to view the data.  I understand this is difficult to solve without see the page so if there are no more suggestions to this, i am going to close the questions and issue out the points.

thanks for all the help and suggestions.
0
 
Michel PlungjanIT ExpertCommented:
Where in the QUERYSTRING you posted are the fields you show in your form???
0
 
Michel PlungjanIT ExpertCommented:
After I
1: change POST to GET
2: add my script
3: change LogTypeid to logtypeid - javascript is case sensitive
4: add options to your dropdown, I get

[08]entry_date=~[short.date]&[08]entry_time=~[time]&[08]entry_author=~[x:username]&[08]logtypeid=This+is+the+first+value+of+logtypeid&[08]consequence=&[08]Subject=This+is+the+first+value+of+logtypeid&[08]entry=&ac=prim&[08]subtype=+&[08]studentid=~(curstudid)


<form...  method="GET" onsubmit="this.elements['[08]Subject'].value=this.elements['[08]logtypeid'].value">
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

  • 7
  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now