Gossamer Forum
Home : Products : Links 2.0 : Customization :

have SELECTED in error page of add / modify forms

Quote Reply
have SELECTED in error page of add / modify forms
Hello everyone!

I have added three dropdown list fields to Links but I have not figured out how to make them like the Category dropdown list. I want it so if there is an error, there will be the word SELECTED in the option of the item that they selected in the add or modify form. Now it just clears them off. Thanks for your help and God bless!



<><-----------------><>
Daniel
AKA Dan the Great
<><-----------------><>
Quote Reply
Re: have SELECTED in error page of add / modify forms In reply to
1) Put the following codes in your sub site_html_add_failure and sub site_html_modify_failure:

Code:

my $fieldname = shift;
$fieldname ?
($fieldname = qq~<input type=hidden name="FieldName" value="$fieldname">~)
:
($fieldname = &build_select_field ("FieldName", "$in{'FieldName'}"));


Replace fieldname with the name of your field in lower case. Replace FieldName with the EXACT name of your field defined in the links.def file.

2) Define the fieldname tag as follows in those sub-routines:

Code:

fieldname => $fieldname,


3) Then in your add_error.html and modify_error.html files, add the following codes:

Code:

<%fieldname%>


BTW: There are a number of Threads that talk about Adding drop-down menus and select fields in this forum.

Good luck!

Regards,


Eliot Lee
Quote Reply
Re: have SELECTED in error page of add / modify forms In reply to
Thanks a bunch Anthro! It works like a charm! God bless!



<><-----------------><>
Daniel
AKA Dan the Great
<><-----------------><>
Quote Reply
Re: have SELECTED in error page of add / modify forms In reply to
You're welcome.

Regards,

Eliot Lee
Quote Reply
Re: have SELECTED in error page of add / modify forms In reply to
Hello Everyone!

Sorry to revive this old thread but it had to do with what I need.

I inserted the code into my version Links and everything works except that it does insert the <input type=hidden name="FieldName" value="$fieldname"> into the add_error.html page, it just sticks the value that the user selected in the previous form.

Any help is welcomed! God bless!


<><-----------------><>
Daniel
AKA Dan the Great
<><-----------------><>
Quote Reply
Re: have SELECTED in error page of add / modify forms In reply to
You have to change FieldName to EXACT name of your field defined in the links.def file and then change $fieldname to be the same as the FieldName but in lower case.

Got it?

Regards,

Eliot Lee
Quote Reply
Re: have SELECTED in error page of add / modify forms In reply to
I've done that. Could I insert the same code that they have as the Category? Here is what I have in the site_html_templates.pl:

Code:
my $FileType = shift;
$FileType ?
($FileType = qq~<input type=hidden name="FileType" value="$FileType">~)
:
($FileType = &build_select_field ("FileType", "$in{'FileType'}"));
my $LicenseType = shift;
$LicenseType ?
($LicenseType = qq~<input type=hidden name="LicenseType" value="$LicenseType">~)
:
($LicenseType = &build_select_field ("LicenseType", "$in{'LicenseType'}"));
my $Platform = shift;
$Platform ?
($Platform = qq~<input type=hidden name="Platform" value="$Platform">~)
:
($Platform = &build_select_field ("Platform", "$in{'Platform'}"));
my $OperateSys = shift;
$OperateSys ?
($OperateSys = qq~<input type=hidden name="OperateSys" value="$OperateSys">~)
:
($OperateSys = &build_select_field ("OperateSys", "$in{'OperateSys'}"));
It is right above the code for the Categories and below the my $errormsg thing in the site_html_add_faliure. Thanks for the help! God bless!



<><-----------------><>
Daniel
AKA Dan the Great
<><-----------------><>
Quote Reply
Re: have SELECTED in error page of add / modify forms In reply to
After re-reading your previous reply:

In Reply To:
I inserted the code into my version Links and everything works except that it does insert the <input type=hidden name="FieldName" value="$fieldname"> into the add_error.html page, it just sticks the value that the user selected in the previous form.
I realized that the codes I gave you are working they are supposed to work. Refer to the bolded text...That is what it does.

How do you want the code hack to function??? Be specific!

Regards,

Eliot Lee
Quote Reply
Re: have SELECTED in error page of add / modify forms In reply to
I'm very sorry, there is a typo in that paragraph. "does" should be "doesn't". You go through and select what you want from the dorpdown lists that we're working on on the add form and say you miss something. You go to the error page and all it does it put the word of what you selected and not a hidden input field to save the data. So you click the submit button after you have corrected you previous error and it gives you errors saying that you didn't specify the dropdown lists fields that we are trying to fix. To look at what I'm working on, visit http://www.christian-search.net/...load/cgi-bin/add.cgi. Thank you again for your help and time. God bless!



<><-----------------><>
Daniel
AKA Dan the Great
<><-----------------><>
Quote Reply
Re: have SELECTED in error page of add / modify forms In reply to
Why would you want it selected if there are error messages??? That IMHO is not the way to go because novice users will not know to click on the BACK button to make changes to their selection!

All you have to do is add HIDDEN fields in your add_error.html file, like the following:

Code:

<input type="hidden" name="FieldName" value="<%FieldName%>">


Regards,




Eliot Lee